mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-15 21:16:38 +00:00
Compare commits
530
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b29fe5976 | ||
|
|
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 | ||
|
|
3263cdd42e | ||
|
|
c6a2f0628d | ||
|
|
39dc110f91 | ||
|
|
a3b179d916 | ||
|
|
84b6a9dfb3 | ||
|
|
c6b98d3891 | ||
|
|
8621923a5e | ||
|
|
c096e54196 | ||
|
|
663841fd31 | ||
|
|
02ab9ce41d | ||
|
|
442c6c9c6f | ||
|
|
5df1e69be1 | ||
|
|
f7226bcc2d | ||
|
|
0b9b69be38 | ||
|
|
5888fd4024 | ||
|
|
1b2b9a6a0d | ||
|
|
a207ace664 | ||
|
|
38b637bdfc | ||
|
|
a96582f13b | ||
|
|
8cf790dea1 | ||
|
|
e58b48e89c | ||
|
|
210d34a088 | ||
|
|
ed5a974ab0 | ||
|
|
bb7f2e4210 | ||
|
|
31b2848051 | ||
|
|
5ebe7edcb3 | ||
|
|
ed68bc6095 | ||
|
|
6a9e52543b | ||
|
|
f1c31423d7 | ||
|
|
441dc97d75 | ||
|
|
8378373527 | ||
|
|
d76514d892 | ||
|
|
2bbfddb533 | ||
|
|
85e5585a1c | ||
|
|
e6840ed921 | ||
|
|
cb20f5cafe | ||
|
|
a95a14cebf | ||
|
|
8b9cc5ba81 | ||
|
|
259a07f733 | ||
|
|
a9674113d1 | ||
|
|
168786cfcf | ||
|
|
3f43cfbb6a | ||
|
|
93578a5789 | ||
|
|
89eaec22b5 | ||
|
|
a99c6916f3 | ||
|
|
30c8d9b166 | ||
|
|
5a6d9048e5 | ||
|
|
0e9275fb37 | ||
|
|
b08b041503 | ||
|
|
9c340ef86f | ||
|
|
baf702a009 | ||
|
|
65ab4040fc | ||
|
|
c3d0c735b8 | ||
|
|
1a5342e468 | ||
|
|
eeaaaf7fce | ||
|
|
5dd18df5eb | ||
|
|
6deb70d17d | ||
|
|
5babe27344 | ||
|
|
ac4adcc2f7 | ||
|
|
46e793d8dc | ||
|
|
cc2149097f | ||
|
|
cdb852e21f | ||
|
|
c18cbd0f35 | ||
|
|
40fe027642 | ||
|
|
2184a5a584 | ||
|
|
b2f06ce507 | ||
|
|
80553d8fc7 | ||
|
|
5b4eeb628c | ||
|
|
2af0c3bbdf | ||
|
|
d4e86c36ed | ||
|
|
fe4a118383 | ||
|
|
ada04f382d | ||
|
|
e1505662ad | ||
|
|
3766f870d4 | ||
|
|
e4c30e6b89 | ||
|
|
9543e9c111 | ||
|
|
d0551c2a7c | ||
|
|
66df106383 | ||
|
|
4c6e92bdb8 | ||
|
|
b2732089f2 | ||
|
|
8e8f8ece29 | ||
|
|
7275b5a177 | ||
|
|
5f0305e605 | ||
|
|
2a0e69c111 | ||
|
|
74c2e50253 | ||
|
|
cb915e0498 | ||
|
|
3379ffa7ed | ||
|
|
0053324a83 | ||
|
|
a0c001aa70 | ||
|
|
7b6a710bd0 | ||
|
|
221d4b346b | ||
|
|
1e60e670ba | ||
|
|
fdec1ab00e | ||
|
|
1aac6063a4 | ||
|
|
0808ccd417 | ||
|
|
61c00477b4 | ||
|
|
9ea8c7ddd4 | ||
|
|
d6cc9d4f01 | ||
|
|
c07cd30cd0 | ||
|
|
c9af2f28e2 | ||
|
|
ea54e26972 | ||
|
|
0ac2170517 | ||
|
|
bd6b53c1d8 | ||
|
|
ca90ec2cac | ||
|
|
91abce9917 | ||
|
|
4cc252ca16 | ||
|
|
1ed5d89106 | ||
|
|
c262cf962c | ||
|
|
8e510ef9b9 | ||
|
|
1aaadf3ca3 | ||
|
|
ca98ed755c | ||
|
|
2fe16812bd | ||
|
|
a300b68b08 | ||
|
|
b9d98f0098 | ||
|
|
deb89ce2f4 | ||
|
|
405101d10d | ||
|
|
bc11725188 | ||
|
|
938e964beb | ||
|
|
49118556bb | ||
|
|
47d30e40e4 | ||
|
|
4135978add | ||
|
|
86bdf2b049 | ||
|
|
1d6cca1b2f | ||
|
|
1e12ed5e1a | ||
|
|
6fe6810c8a | ||
|
|
408c183013 | ||
|
|
cdb4683c30 | ||
|
|
3a6eb48e1e | ||
|
|
2706fda4a6 | ||
|
|
fafe8a19b8 | ||
|
|
69eaab8aac | ||
|
|
6035439314 | ||
|
|
79ed81e971 | ||
|
|
ca53f68729 | ||
|
|
2b66aa860f | ||
|
|
17cef37fd1 | ||
|
|
fa2f1ac2a4 | ||
|
|
a9e21b0a18 | ||
|
|
353b838a13 | ||
|
|
a68c033bf9 | ||
|
|
8c7af900cf | ||
|
|
8e46f4b273 | ||
|
|
86337bac18 | ||
|
|
125d5a2b73 | ||
|
|
de23ffbee3 | ||
|
|
6af73a9f5e | ||
|
|
df8c668559 | ||
|
|
c346be31a1 | ||
|
|
a360d7d794 | ||
|
|
a9b6b75a02 | ||
|
|
fa8c24ff7a | ||
|
|
fb4f76e78d | ||
|
|
f261a8f571 | ||
|
|
5bffdef46d |
No files matched your search
@@ -1,53 +1,207 @@
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
03 Feb 2004, Version 4.3.5RC2
|
||||
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 #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, tony2001 at phpclub dot net)
|
||||
- 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)
|
||||
- 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)
|
||||
- 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
|
||||
allocation functions. (Ilia)
|
||||
- Fixed zero bytes memory allocation when no extra ini files are found in the
|
||||
--with-config-file-scan-dir specified directory. (Eric Colinet, Derick)
|
||||
- Changed "allow_url_fopen" php.ini option to be PHP_INI_SYSTEM. (Sara)
|
||||
- Improved the sybase_ct module: (Timm)
|
||||
. Added ability to define a message handler not only globally, but also per
|
||||
. Added ability to define a message handler not only globally, but also per
|
||||
connection.
|
||||
. 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().
|
||||
- Fixed bug #27058 (crash in sybase_connect() with 2 arguments). (Ilia)
|
||||
- Fixed bug #27056 (ints used instead of longs inside some GD functions).
|
||||
(Ilia)
|
||||
- Fixed bug #27040 (passing an array of form-fields to CURLOPT_POSTFIELDS
|
||||
does not work). (Ilia, Jani)
|
||||
- Fixed bug #27037 (fixed possible crash in apache2handler output code). (Ilia)
|
||||
- Fixed bug #27011 (64bit int/long confusion in preg_match*() functions).
|
||||
(Ilia)
|
||||
- Fixed bug #27007 (missing connection closure when connect fails in pgsql).
|
||||
(Ilia)
|
||||
- Fixed bug #26974 (rename() doesn't check the destination file against
|
||||
safe_mode/open_basedir). (Ilia)
|
||||
- Fixed bug #26973 (*printf() '+' modifier broken). (Jani)
|
||||
- Fixed bug #26969 (--with-openssl=shared build fails). (Jani)
|
||||
- Fixed bug #26968 (Segfault with Interbase module built as shared). (Ard)
|
||||
- Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled). (Jani)
|
||||
- Fixed bug #26937 (Warning in xml.c). (Jani)
|
||||
- Fixed Bug #26927 (preg_quote() does not escape \0). (Ilia)
|
||||
- Fixed bug #26923 (ext/imap: pam and crypt libraries missing when build as
|
||||
shared extension). (Jani)
|
||||
- Fixed bug #26909 (crash in imap_mime_header_decode() when no encoding is
|
||||
used). (Ilia)
|
||||
- Fixed bug #26892 (ORA-21301 in ocinewcollection() call). (Antony)
|
||||
- Fixed bug #26878 (problem with multiple references to the same variable
|
||||
with different types). (Ilia)
|
||||
- Fixed bug #26896 (ext/ftp does not work as shared extension). (Jani)
|
||||
- Fixed bug #26814 (When included file has a parse error, terminate script
|
||||
execution). (Ilia)
|
||||
- Fixed bug #26772, #26967 (file operations return NULL instead of FALSE).
|
||||
(Wez, Ilia)
|
||||
- Fixed bug #26381 (rand() without srand() doesn't work with certain php.ini).
|
||||
(Jani)
|
||||
- Fixed bug #25753 (php.ini settings "leak" from vhosts/.htaccess files).
|
||||
(Patch by: rover at tob dot ru)
|
||||
- Fixed bug #22403 (PHP crashes when executing a sql procedure without
|
||||
parameters). (Timm)
|
||||
- Fixed bug #21513 (shutdown functions not executed if timed out). (Zeev)
|
||||
|
||||
12 Jan 2004, Version 4.3.5RC1
|
||||
- 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)
|
||||
@@ -56,27 +210,123 @@ PHP 4 NEWS
|
||||
- Added a warning when creating temp stream fails with ftp_(n)list(). (Sara)
|
||||
- Fixed header handler in NSAPI SAPI module (header->replace was ignored,
|
||||
send_default_content_type now sends value from php.ini). (Uwe Schindler)
|
||||
- Fixed bug #27633 (Incorrect EOL translation by ftp_get() in ASCII mode).
|
||||
(Ilia)
|
||||
- Fixed bug #27600 (GCC 3.0.4 does not like __attribute__ directive). (Sascha)
|
||||
- Fixed bug #27590 (crash during shutdown when freeing persistent resources in
|
||||
ZTS mode). (Ilia)
|
||||
- Fixed bug #27582 (possible crashes in imagefilltoborder()). (Pierre)
|
||||
- Fixed bug #27580 (pre-initialization errors in ap2 handler are not being
|
||||
written to vhost error log). (Ilia)
|
||||
- Fixed bug #27559 (Corrected open_basedir resolving logic). (Ilia)
|
||||
- Fixed bug #27530 (broken http auth when safe_mode is on and PCRE is disabled).
|
||||
(Ilia)
|
||||
- Fixed bug #27509 (broken getaddrinfo() causes fsockopen() error). (Sara)
|
||||
- Fixed bug #27505 (htmlentities() does not handle BIG5 correctly). (Ilia,
|
||||
ywliu at hotmail dot com)
|
||||
- Fixed bug #27498 (bogus safe_mode error on nonexistent directories for
|
||||
chdir() and opendir() functions). (Ilia)
|
||||
- Fixed bug #27460 (base64_decode() does not handle extra padding).
|
||||
(Ilia, naish at klanen dot net)
|
||||
- Fixed bug #27443 (defined() returns wrong type). (Derick)
|
||||
- Fixed bug #27437 (wrong freetype include inside GD library). (Ilia)
|
||||
- Fixed bug #27424 (headers missing on flush() in apache 2 SAPIs). (Ilia)
|
||||
- Fixed bug #27421 (mbstring.func_overload should be system ini setting).
|
||||
(Ilia)
|
||||
- Fixed bug #27384 (unpack() misbehaves with 1 char string). (GeorgeS)
|
||||
- Fixed bug #27383 (Potential crash inside fopen_wrapper, while
|
||||
parsing response code). (Ilia)
|
||||
- Fixed bug #27354 (Modulus operator crashes PHP). (Derick)
|
||||
- Fixed bug #27341 (HEAD requests fail to return data). (Ilia)
|
||||
- Fixed bug #27337 (missing sapi_shutdown() in sapi/isapi causes memory leak).
|
||||
(Jani, msisolak at yahoo dot com)
|
||||
- Fixed bug #27328 (ftp extension relies on 32-bit longs). (Sara)
|
||||
- Fixed bug #27300 (Improved regex for pg_convert()).
|
||||
(benjcarson at digitaljunkies dot ca, Ilia)
|
||||
- Fixed bug #27295 (memory leak inside sscanf()). (Ilia)
|
||||
- Fixed bug #27293 (two crashes inside image2wbmp()). (Ilia)
|
||||
- Fixed bug #27291 (get_browser matches browscap.ini patterns incorrectly).
|
||||
(Jay)
|
||||
- Fixed bug #27278 (*printf() functions treat arguments as if passed by
|
||||
reference). (Ilia)
|
||||
- Fixed bug #27238 (iptcparse() function misses some fields). (Pierre)
|
||||
- Fixed bug #27235 (Interbase NUMERIC x.0 field returns empty string on 0).
|
||||
(Ard)
|
||||
- Fixed bug #27196 (Missing content_length initialization in apache 2 sapis).
|
||||
(Ilia, pdoru at kappa dot ro)
|
||||
- Fixed bug #27183 (userland stream wrapper segfaults on stream_write).
|
||||
(Moriyoshi)
|
||||
- Fixed bug #27175 (tzset() is not being called by PHP on startup).
|
||||
(Ilia, sagawa at sohgoh dot net)
|
||||
- Fixed bug #27172 (Possible floating point exception in gmp_powm()).
|
||||
(Ilia)
|
||||
- Fixed bug #27171 (crash inside gmp_hamdist()). (Jani)
|
||||
- Fixed bug #27157 (Compile Failure on Solaris 8). (Timm)
|
||||
- Fixed bug #27149 (broken CLOB support in oci8 extension). (Antony)
|
||||
- Fixed bug #27135 (Possible crash inside mb_strlen()). (Moriyoshi)
|
||||
- Fixed bug #27104 (CLI/CGI SAPI module variable name conflict). (Marcus)
|
||||
- Fixed bug #27058 (crash in sybase_connect() with 2 arguments). (Ilia)
|
||||
- Fixed bug #27056 (ints used instead of longs inside some GD functions).
|
||||
(Ilia)
|
||||
- Fixed bug #27040 (passing an array of form-fields to CURLOPT_POSTFIELDS
|
||||
does not work). (Ilia, Jani)
|
||||
- Fixed bug #27037 (fixed possible crash in apache2handler output code).
|
||||
(Ilia)
|
||||
- Fixed bug #27026 (Added "cgi.nph" php.ini option to allow forcing of the
|
||||
'Status: 200' header that is not normally needed). (Ilia)
|
||||
- Fixed bug #27011 (64bit int/long confusion in preg_match*() functions).
|
||||
(Ilia)
|
||||
- Fixed bug #27007 (missing connection closure when connect fails in pgsql).
|
||||
(Ilia)
|
||||
- Fixed bug #26974 (rename() doesn't check the destination file against
|
||||
safe_mode/open_basedir). (Ilia)
|
||||
- Fixed bug #26973 (*printf() '+' modifier broken). (Jani)
|
||||
- Fixed bug #26969 (--with-openssl=shared build fails). (Jani)
|
||||
- Fixed bug #26968 (Segfault with Interbase module built as shared). (Ard)
|
||||
- Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled). (Jani)
|
||||
- Fixed bug #26937 (Warning in xml.c). (Jani)
|
||||
- Fixed bug #26927 (preg_quote() does not escape \0). (Ilia)
|
||||
- Fixed bug #26923 (ext/imap: pam and crypt libraries missing when build as
|
||||
shared extension). (Jani)
|
||||
- Fixed bug #26909 (crash in imap_mime_header_decode() when no encoding is
|
||||
used). (Ilia)
|
||||
- Fixed bug #26896 (ext/ftp does not work as shared extension). (Jani)
|
||||
- Fixed bug #26892 (ORA-21301 in ocinewcollection() call). (Antony)
|
||||
- Fixed bug #26878 (problem with multiple references to the same variable with
|
||||
different types). (Ilia)
|
||||
- Fixed bug #26864 (pg_(update|delete) ignore PGSQL_DML_EXEC option). (Ilia)
|
||||
- Fixed bug #26862 (ob_flush() followed by output_reset_rewrite_vars() may
|
||||
result in data loss). (Ilia, scottmacvicar at ntlworld dot com)
|
||||
- Fixed bug #26847 (memory leak in mail() when to/subject contain only spaces).
|
||||
(Ilia)
|
||||
- Fixed bug #26814 (When included file has a parse error, terminate script
|
||||
execution). (Ilia)
|
||||
- Fixed bug #26777 (ext/interbase: Let DB handle NULL params). (Ard)
|
||||
- Fixed bug #26755 (CLI now overrides php.ini settings and switches off
|
||||
output buffering). (Edin)
|
||||
- Fixed bug #26752 (Silent unterminated loop when length parameter for
|
||||
fgets(), fread() and fgetss() is 0). (Ilia)
|
||||
- Fixed bug #26772, #26967 (file operations return NULL instead of FALSE).
|
||||
(Wez, Ilia)
|
||||
- Fixed bug #26758 (FastCGI exits immediately with status 255).
|
||||
(Ilia, tcarter at noggin dot com dot au)
|
||||
- Fixed bug #26755 (CLI now overrides php.ini settings and switches off output
|
||||
buffering). (Edin)
|
||||
- Fixed bug #26753 (zend_fetch_list_dtor_id() doesn't check NULL strings).
|
||||
(Jani, Markus dot Lidel at shadowconnect dot com)
|
||||
- Fixed bug #26752 (Silent unterminated loop when length parameter for fgets(),
|
||||
fread() and fgetss() is 0). (Ilia)
|
||||
- Fixed bug #26751 (PHP can't find the MySQL socket on a case sensitive file
|
||||
system). (Derick)
|
||||
- Fixed Bug #26703 (Certain characters inside strings incorrectly treated as
|
||||
keywords). (vrana [at] php [dot] net, Ilia)
|
||||
- Fixed bug #26703 (Certain characters inside strings incorrectly treated
|
||||
as keywords). (vrana [at] php [dot] net, Ilia)
|
||||
- Fixed bug #26699 (mbstring doesn't identify "binary" as a valid encoding).
|
||||
(nirva-php at ishiboo dot com, Moriyoshi)
|
||||
- Fixed bug #26667 (Added safety checks to ip2long()). (Ilia)
|
||||
- Fixed bug #26653 (open_basedir incorrectly resolved on win32).
|
||||
(Ilia, scottmacvicar at ntlworld dot com)
|
||||
- Fixed bug #26639 (mb_convert_variables() clutters variables beyond the
|
||||
references). (Moriyoshi)
|
||||
- Fixed bug #26635 (fixed look up for fonts in the current directory w/ZTS).
|
||||
(Ilia)
|
||||
- Fixed Bug #26625 (pg_convert sets NULL incorrectly for character data
|
||||
types). (Ilia)
|
||||
- Fixed bug #26625 (pg_convert sets NULL incorrectly for character data types).
|
||||
(Ilia)
|
||||
- Fixed bug #26604 (Apache2 SAPIs implicitly disable Keep-Alive). (Ilia)
|
||||
- Fixed bug #26595 (ext/domxml: XSLT_NAMESPACE undeclared). (Christian)
|
||||
- Fixed bug #26565 (strtotime("this month") resolving to the wrong month).
|
||||
@@ -86,24 +336,25 @@ PHP 4 NEWS
|
||||
- Fixed bug #26531 (ext/domxml: get_elements_by_tag_name() wildcard fails).
|
||||
(Rob Richards)
|
||||
- Fixed bug #26488 (Missing declaration of CRTSCTS in ext/dio/dio.c). (Jani)
|
||||
- Fixed bug #26467 (flock() does not force the "wouldblock" parameter to be
|
||||
- Fixed bug #26467 (flock() does not force the "wouldblock" parameter to be
|
||||
passed by reference). (Wez)
|
||||
- Fixed bug #26463 (Incorrect handling of semicolons after heredoc). (Ilia)
|
||||
- Fixed bug #26462 (phpize + ext/bcmath -> compile error). (Jani)
|
||||
- Fixed bug #26461 (-lssl missing from LIBS). (Jani)
|
||||
- Fixed bug #26458 (var_dump(), var_export(), debug_zval_dump() not binary
|
||||
safe for array keys). (Ilia)
|
||||
- Fixed bug #26458 (var_dump(), var_export(), debug_zval_dump() not binary safe
|
||||
for array keys). (Ilia)
|
||||
- Fixed bug #26447 (--with-openssl=shared causes compile errors). (Jani)
|
||||
- Fixed bug #26446 (domxml_open_file() returns an empty error-Array). (Rob)
|
||||
- Fixed bug #26440 (MFH missing context options). (Ilia)
|
||||
- Fixed bug #26438 (error in thttpd SAPI installation). (Jani)
|
||||
- Fixed bug #26391 (parse_url() destroys strings that contain a character
|
||||
in range of \x80-\xff)). (Moriyoshi)
|
||||
- Fixed bug #26415 (Updated bundled OpenSSL DLLs in the Windows
|
||||
distribution to 0.9.7c). (Edin)
|
||||
- Fixed bug #25963 (PostgreSQL error message include \n characters).
|
||||
(Marcus, Ilia)
|
||||
- Fixed bug #26415 (Updated bundled OpenSSL DLLs in the Windows distribution
|
||||
to 0.9.7c). (Edin)
|
||||
- Fixed bug #26407 (Result set fetching broken around transactions). (Timm)
|
||||
- Fixed bug #26391 (parse_url() destroys strings that contain a character in
|
||||
range of \x80-\xff)). (Moriyoshi)
|
||||
- Fixed bug #26384 (crash in domxslt->process()). (Christian)
|
||||
- Fixed bug #26381 (rand() without srand() doesn't work with certain php.ini).
|
||||
(Jani)
|
||||
- Fixed bug #26376 (typo in ext/odbc/config.m4: DBMaker test fails). (Jani)
|
||||
- Fixed bug #26355 (flock() doesn't initialize the wouldblock argument). (Ilia)
|
||||
- Fixed bug #26309 (Fixed argument parsing for imageftbbox()). (Ilia)
|
||||
@@ -120,36 +371,55 @@ PHP 4 NEWS
|
||||
- Fixed bug #26194 (iconv() not properly defined with libiconv).
|
||||
(Steph, Frank, Moriyoshi)
|
||||
- Fixed bug #26176 (Fixed handling of numeric keys in INI files). (Ilia)
|
||||
- Fixed bug #26168 (shtool availability check in phpize).
|
||||
- Fixed bug #26168 (shtool availability check in phpize).
|
||||
(robbat2 at gentoo dot org, Ilia)
|
||||
- Fixed bug #26148 (Print the notice before modifying variable on type
|
||||
mismatch). (morten-bugs dot php dot net at afdelingp dot dk, Ilia)
|
||||
- Fixed bug #26128 (mbstring prints out wrong information on phpinfo()).
|
||||
(Moriyoshi)
|
||||
- Fixed bug #26113 (remove leftover local file when ftp_get/ftp_nb_get fails).
|
||||
(Ilia)
|
||||
- Fixed bug #26105 (Compile failure on gcc version 3.0.X). (Ilia)
|
||||
- Fixed bug #26113 (remove leftover local file when ftp_get/ftp_nb_get
|
||||
fails). (Ilia)
|
||||
- Fixed bug #26105 (Compile failure on GCC version 3.0.X). (Ilia)
|
||||
- Fixed bug #26103 (ext/mime_magic causes compile failure in ext/mssql). (Jani)
|
||||
- Fixed bug #26097 (gdImageColorClosestAlpha() returns incorrect results).
|
||||
(sprice at wisc dot edu, Ilia)
|
||||
- Fixed bug #26042 (memory leak if mcrypt_generic_deinit() is not called
|
||||
after every mcrypt_generic_init() call). (Ilia)
|
||||
- Fixed bug #26042 (memory leak if mcrypt_generic_deinit() is not called after
|
||||
every mcrypt_generic_init() call). (Ilia)
|
||||
- Fixed bug #26025 (Segfault on glob() without GLOB_NOCHECK or GLOB_NOMAGIC
|
||||
under *BSD platforms). (Moriyoshi)
|
||||
- Fixed bug #26005 (Random "cannot change the session ini settings" errors).
|
||||
(Jani, jsnajdr at kerio dot com)
|
||||
- Fixed bug #26003 (Make fgetcsv() binary safe). (Ilia, Moriyoshi)
|
||||
- Fixed bug #25963 (PostgreSQL error message include \n characters).
|
||||
(Marcus, Ilia)
|
||||
- Fixed bug #25939 (feof() not working correctly for sockets). (Wez)
|
||||
- Fixed bug #25916 (get_browser() -> PHP Fatal error: Nesting level
|
||||
too deep - recursive dependency?). (Uwe Schindler)
|
||||
- Fixed bug #25916 (get_browser() -> PHP Fatal error: Nesting level too
|
||||
deep - recursive dependency?). (Uwe Schindler)
|
||||
- Fixed bug #25794 (Cannot open existing hash db3 file with write" ext/dba).
|
||||
(Marcus)
|
||||
- Fixed Bug #25694 (round() and number_format() give inconsistent results).
|
||||
- Fixed bug #25753 (php.ini settings "leak" from vhosts/.htaccess files).
|
||||
(Patch by: rover at tob dot ru)
|
||||
- Fixed bug #25694 (round() and number_format() give inconsistent results).
|
||||
(Ilia)
|
||||
- Fixed bug #25664 (calling ITypeInfo::Invoke with bogus params). (Wez)
|
||||
- Fixed bug #25581 (getimagesize () return incorrect values on bitmap
|
||||
(os2) files). (Marcus)
|
||||
- Fixed bug #25329 (sqlite_create_function with method and reference to $this).
|
||||
(Marcus).
|
||||
- Fixed bug #25581 (getimagesize () return incorrect values on bitmap (os2)
|
||||
files). (Marcus)
|
||||
- Fixed bug #25329 (sqlite_create_function with method and reference to
|
||||
$this). (Marcus).
|
||||
- Fixed bug #24773 (unsetting string as array causes a crash). (Sara)
|
||||
- Fixed bug #24773 (Unsetting string offsets crashes PHP). (Moriyoshi, Sara)
|
||||
- Fixed bug #24582 (extensions can't be loaded dynamically in Solaris/iPlanet).
|
||||
(Jani)
|
||||
- Fixed bug #23467 (date('T') outputs incorrect Time Zone).
|
||||
(Jani, scottmacvicar at ntlworld dot com)
|
||||
- Fixed bug #22403 (PHP crashes when executing a sql procedure without
|
||||
parameters). (Timm)
|
||||
- Fixed bug #22127 (Invalid response code when force-cgi-redirect safety
|
||||
mechanism is triggered). (Ilia, scottmacvicar at ntlworld dot com)
|
||||
- Fixed bug #21760 (Use of uninitialized pointer inside php_read()).
|
||||
(Ilia, uce at ftc dot gov)
|
||||
- Fixed bug #21513 (shutdown functions not executed if timed out). (Zeev)
|
||||
- Fixed bug #21070 (ftp_genlist/ANSI-tmpfile() fail w/ some platform). (Sara)
|
||||
|
||||
3 Nov 2003, Version 4.3.4
|
||||
- Made MCVE extension available on win32. (Jani)
|
||||
|
||||
+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);
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ snapshot:
|
||||
md5sum $$distname.tar.bz2; \
|
||||
bzip2 -t $$distname.tar.bz2
|
||||
|
||||
cvsclean:
|
||||
cvsclean-work:
|
||||
@for i in `find . -name .cvsignore`; do \
|
||||
(cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore | grep -v config.nice` *.o *.a .libs || true); \
|
||||
done
|
||||
|
||||
+44
-9
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=4
|
||||
MINOR_VERSION=3
|
||||
RELEASE_VERSION=5
|
||||
EXTRA_VERSION="RC2"
|
||||
RELEASE_VERSION=9
|
||||
EXTRA_VERSION=""
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -521,10 +521,45 @@ vsnprintf \
|
||||
)
|
||||
|
||||
dnl Check for getaddrinfo, should be a better way, but...
|
||||
dnl Also check for working getaddrinfo
|
||||
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
|
||||
[AC_TRY_LINK([#include <netdb.h>],
|
||||
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
|
||||
ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
|
||||
[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
|
||||
AC_TRY_RUN([
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
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) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ai == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pai = ai;
|
||||
|
||||
while (pai) {
|
||||
if (pai->ai_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
}
|
||||
if (pai->ai_addr->sa_family != AF_INET) {
|
||||
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
|
||||
exit(1);
|
||||
}
|
||||
pai = pai->ai_next;
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
exit(0);
|
||||
}
|
||||
],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no),
|
||||
ac_cv_func_getaddrinfo=no)])
|
||||
if test "$ac_cv_func_getaddrinfo" = yes; then
|
||||
AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
|
||||
fi
|
||||
@@ -822,15 +857,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
|
||||
@@ -838,7 +873,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
|
||||
|
||||
@@ -1372,7 +1407,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. |
|
||||
+--------------------------------------------------------------------+
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
${MAKE:-make} -f build/build.mk cvsclean
|
||||
${MAKE:-make} -f build/build.mk cvsclean-work
|
||||
+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);
|
||||
|
||||
+21
-6
@@ -476,6 +476,7 @@ PHP_FUNCTION(cpdf_open)
|
||||
php_error(E_WARNING, "%s(): Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.", get_active_function_name(TSRMLS_C));
|
||||
#endif
|
||||
if (php_check_open_basedir(Z_STRVAL_P(arg2) TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(Z_STRVAL_P(arg2), "rb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
cpdf_close(cpdf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2521,16 +2522,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) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
||||
} \
|
||||
SEPARATE_ZVAL(&c); \
|
||||
convert_to_string(c); \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
char *p; \
|
||||
|
||||
+96
-19
@@ -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);
|
||||
@@ -368,6 +425,9 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
if (Z_TYPE_P(retval) != IS_LONG) {
|
||||
convert_to_long_ex(&retval);
|
||||
}
|
||||
length = Z_LVAL_P(retval);
|
||||
}
|
||||
|
||||
@@ -400,7 +460,6 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
case PHP_CURL_USER: {
|
||||
zval *argv[3];
|
||||
zval *retval;
|
||||
int length;
|
||||
int error;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
@@ -422,11 +481,9 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
if (error == FAILURE) {
|
||||
php_error(E_WARNING, "%s(): Cannot call the CURLOPT_READFUNCTION",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
memcpy(data, Z_STRVAL_P(retval), size * nmemb);
|
||||
length = Z_STRLEN_P(retval);
|
||||
} else if (Z_TYPE_P(retval) == IS_STRING) {
|
||||
length = MIN(size * nmemb, Z_STRLEN_P(retval));
|
||||
memcpy(data, Z_STRVAL_P(retval), length);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -485,6 +542,9 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
length = -1;
|
||||
}
|
||||
else {
|
||||
if (Z_TYPE_P(retval) != IS_LONG) {
|
||||
convert_to_long_ex(&retval);
|
||||
}
|
||||
length = Z_LVAL_P(retval);
|
||||
}
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -492,13 +552,18 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
zval_ptr_dtor(&retval);
|
||||
break;
|
||||
}
|
||||
|
||||
case PHP_CURL_IGNORE:
|
||||
return length;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if CURLOPT_PASSWDFUNCTION != 0
|
||||
/* {{{ curl_passwd
|
||||
*/
|
||||
static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
@@ -508,7 +573,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
zval *argv[3];
|
||||
zval *retval = NULL;
|
||||
int error;
|
||||
int ret = 0;
|
||||
int ret = -1;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
MAKE_STD_ZVAL(argv[0]);
|
||||
@@ -526,17 +591,15 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
retval, 2, argv TSRMLS_CC);
|
||||
if (error == FAILURE) {
|
||||
php_error(E_WARNING, "%s(): Couldn't call the CURLOPT_PASSWDFUNCTION", get_active_function_name(TSRMLS_C));
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
} else if (Z_TYPE_P(retval) == IS_STRING) {
|
||||
if (Z_STRLEN_P(retval) > buflen) {
|
||||
php_error(E_WARNING, "%s(): Returned password is too long for libcurl to handle",
|
||||
get_active_function_name(TSRMLS_C));
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
strlcpy(buf, Z_STRVAL_P(retval), buflen);
|
||||
} else {
|
||||
strlcpy(buf, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string.", Z_STRVAL_P(func));
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&argv[0]);
|
||||
@@ -547,6 +610,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ curl_free_string
|
||||
*/
|
||||
@@ -692,7 +756,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:
|
||||
@@ -716,6 +782,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;
|
||||
@@ -802,7 +874,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
|
||||
if (Z_LVAL_PP(zvalue)) {
|
||||
ch->handlers->write->method = PHP_CURL_RETURN;
|
||||
}
|
||||
} else {
|
||||
ch->handlers->write->method = PHP_CURL_STDOUT;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_BINARYTRANSFER:
|
||||
convert_to_long_ex(zvalue);
|
||||
@@ -835,6 +909,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);
|
||||
@@ -844,6 +919,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;
|
||||
@@ -886,7 +962,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);
|
||||
}
|
||||
@@ -1020,7 +1096,8 @@ PHP_FUNCTION(curl_exec)
|
||||
|
||||
error = curl_easy_perform(ch->cp);
|
||||
SAVE_CURL_ERROR(ch, error);
|
||||
if (error != CURLE_OK) {
|
||||
/* CURLE_PARTIAL_FILE is returned by HEAD requests */
|
||||
if (error != CURLE_OK && error != CURLE_PARTIAL_FILE) {
|
||||
if (ch->handlers->write->buf.len > 0) {
|
||||
smart_str_free(&ch->handlers->write->buf);
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ AC_ARG_WITH(db4,
|
||||
[ --with-db4[=DIR] DBA: Include Berkeley DB4 support],[
|
||||
if test "$withval" != "no"; then
|
||||
PHP_DBA_STD_BEGIN
|
||||
for i in $withval /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
|
||||
for i in $withval /usr/local/BerkeleyDB.4.2 /usr/local/BerkeleyDB.4.1 /usr/local/BerkeleyDB.4.0 /usr/local /usr; do
|
||||
if test -f "$i/db4/db.h"; then
|
||||
THIS_PREFIX=$i
|
||||
THIS_INCLUDE=$i/db4/db.h
|
||||
@@ -221,7 +221,7 @@ AC_ARG_WITH(db4,
|
||||
break
|
||||
fi
|
||||
done
|
||||
PHP_DBA_DB_CHECK(4, db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
|
||||
PHP_DBA_DB_CHECK(4, db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
|
||||
fi
|
||||
])
|
||||
AC_DBA_STD_RESULT(db4,Berkeley DB4)
|
||||
|
||||
@@ -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"
|
||||
@@ -163,6 +163,10 @@ PHP_FUNCTION(dio_open)
|
||||
return;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(file_name TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(file_name, "wb+", CHECKUID_CHECK_MODE_PARAM))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 3) {
|
||||
fd = open(file_name, flags, mode);
|
||||
} else {
|
||||
@@ -195,6 +199,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) {
|
||||
@@ -223,6 +232,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);
|
||||
|
||||
+31
-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;
|
||||
@@ -3981,6 +3993,9 @@ static xmlDocPtr domxml_document_parser(int mode, int loadtype, char *source, vo
|
||||
|
||||
ctxt->sax->error = domxml_error_ext;
|
||||
ctxt->sax->warning = domxml_error_ext;
|
||||
#if LIBXML_VERSION >= 20600
|
||||
ctxt->sax->cdataBlock = NULL;
|
||||
#endif
|
||||
ctxt->vctxt.userData= (void *) &errorCtxt;
|
||||
ctxt->vctxt.error = (xmlValidityErrorFunc) domxml_error_validate;
|
||||
ctxt->vctxt.warning = (xmlValidityWarningFunc) domxml_error_validate;
|
||||
@@ -4800,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); */
|
||||
}
|
||||
/* }}} */
|
||||
@@ -5355,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);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
--TEST--
|
||||
Bug #26384 (domxslt->process causes segfault with xsl:key)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php require_once('skipif.inc');
|
||||
if (!function_exists("domxml_xslt_stylesheet_file")) { die("skip No XSLT support found");};
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$xml = domxml_open_mem(file_get_contents(dirname(__FILE__)."/area_name.xml"));
|
||||
|
||||
+74
-76
@@ -83,30 +83,28 @@ typedef struct PHPFBLink PHPFBLink;
|
||||
required buffereing from of results.
|
||||
|
||||
In the PHP code the 3 above a data structures are referenced by means of integers in the
|
||||
range from 1 to som configurable maximum. You can put a limit to the number of links, databases
|
||||
and results. The integer identifications is implemented by insertion in the list, which is passed
|
||||
range from 1 to som configurable maximum. You can put a limit to the number of links, databases
|
||||
and results. The integer identifications is implemented by insertion in the list, which is passed
|
||||
as an argument to all the functions, please note the list is polymorph.
|
||||
|
||||
Database objects and link objects are all reused, base on the host name user name, host name database name
|
||||
user name. So connecting twice to the same database as the same user will return the same database id.
|
||||
user name. So connecting twice to the same database as the same user will return the same database id.
|
||||
We use the same coding for that as fbsql does, explioiting the underlying implementation of the lists.
|
||||
|
||||
Persistent objects are put in the persistent list as well, but only by name, if you connect to a persistent object
|
||||
and it is not in the list it is simply added and get a new index, and refcounted. Tricky, tricky ...
|
||||
and it is not in the list it is simply added and get a new index, and refcounted. Tricky, tricky ...
|
||||
*/
|
||||
|
||||
/* Some functions which should be exported from FBCAccess */
|
||||
|
||||
void* fbaObjectAtIndex();
|
||||
void fbaRelease();
|
||||
unsigned int fbaCount();
|
||||
void* fbaObjectAtIndex();
|
||||
void fbaRelease();
|
||||
unsigned int fbaCount();
|
||||
|
||||
struct FBCAutoStartInfo {
|
||||
FBArray* infoLines;
|
||||
FBArray* infoLines;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct PHPFBResult
|
||||
{
|
||||
PHPFBLink* link; /* The link for the result, may be NULL if no link */
|
||||
@@ -115,7 +113,7 @@ struct PHPFBResult
|
||||
FBCMetaData* ResultmetaData; /* The metadata describing the result */
|
||||
FBCRowHandler* rowHandler; /* The row handler, the Frontbase structure used for accessing rows in the result */
|
||||
unsigned int batchSize; /* The number of row to fetch when expanding the number of rows in the row handler */
|
||||
unsigned int rowCount; /* The number of rows in the results set. The number of row is not in */
|
||||
unsigned int rowCount; /* The number of rows in the results set. The number of row is not in */
|
||||
/* general known when the select is done, one typically needs to fetch all the row
|
||||
to figure out how many row you got. When the rowCount is unknown the value is
|
||||
0x7ffffffff */
|
||||
@@ -280,10 +278,10 @@ static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
FBCMetaData *md = fbcdcCancelFetch(result->link->connection, result->fetchHandle);
|
||||
fbcmdRelease(md);
|
||||
}
|
||||
if (result->rowHandler) fbcrhRelease(result->rowHandler);
|
||||
if (result->ResultmetaData) fbcmdRelease(result->ResultmetaData);
|
||||
if (result->list) fbcplRelease(result->list);
|
||||
if (result->array) fbaRelease(result->array);
|
||||
if (result->rowHandler) fbcrhRelease(result->rowHandler);
|
||||
if (result->ResultmetaData) fbcmdRelease(result->ResultmetaData);
|
||||
if (result->list) fbcplRelease(result->list);
|
||||
if (result->array) fbaRelease(result->array);
|
||||
efree(result);
|
||||
}
|
||||
}
|
||||
@@ -389,7 +387,7 @@ static void php_fbsql_init_globals(zend_fbsql_globals *fbsql_globals)
|
||||
fbsql_globals->persistentCount = 0;
|
||||
fbsql_globals->linkCount = 0;
|
||||
}
|
||||
|
||||
|
||||
PHP_MINIT_FUNCTION(fbsql)
|
||||
{
|
||||
ZEND_INIT_MODULE_GLOBALS(fbsql, php_fbsql_init_globals, NULL);
|
||||
@@ -397,7 +395,7 @@ PHP_MINIT_FUNCTION(fbsql)
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
fbcInitialize();
|
||||
|
||||
fbcehSetMultiThreaded(True);
|
||||
le_result = zend_register_list_destructors_ex(phpfbReleaseResult, NULL, "fbsql result", module_number);
|
||||
le_link = zend_register_list_destructors_ex(phpfbReleaseLink, NULL, "fbsql link", module_number);
|
||||
le_plink = zend_register_list_destructors_ex(NULL, phpfbReleasePLink, "fbsql plink", module_number);
|
||||
@@ -497,12 +495,12 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (argc >= 2)
|
||||
{
|
||||
convert_to_string_ex(argv[1]);
|
||||
userName = Z_STRVAL_PP(argv[1]);
|
||||
}
|
||||
userName = Z_STRVAL_PP(argv[1]);
|
||||
}
|
||||
if (argc == 3)
|
||||
{
|
||||
convert_to_string_ex(argv[2]);
|
||||
userPassword = Z_STRVAL_PP(argv[2]);
|
||||
userPassword = Z_STRVAL_PP(argv[2]);
|
||||
}
|
||||
|
||||
if (hostName == NULL) hostName = FB_SQL_G(hostName);
|
||||
@@ -543,7 +541,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
phpLink->userPassword = strdup(userPassword);
|
||||
phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
|
||||
phpLink->databaseName = NULL;
|
||||
phpLink->execHandler = fbcehHandlerForHost(hostName, 128);
|
||||
phpLink->execHandler = NULL;
|
||||
phpLink->affectedRows = 0;
|
||||
phpLink->autoCommit = FB_SQL_G(autoCommit);
|
||||
phpLink->errorNo = 0;
|
||||
@@ -604,7 +602,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
phpLink->userPassword = strdup(userPassword);
|
||||
phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
|
||||
phpLink->databaseName = NULL;
|
||||
phpLink->execHandler = fbcehHandlerForHost(hostName, 128);
|
||||
phpLink->execHandler = NULL;
|
||||
phpLink->affectedRows = 0;
|
||||
phpLink->autoCommit = FB_SQL_G(autoCommit);
|
||||
phpLink->errorNo = 0;
|
||||
@@ -613,7 +611,7 @@ static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, phpLink, le_link);
|
||||
|
||||
le.ptr = (void *)Z_LVAL_P(return_value);
|
||||
le.ptr = (void *)Z_LVAL_P(return_value);
|
||||
Z_TYPE(le) = le_index_ptr;
|
||||
if (zend_hash_update(&EG(regular_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE)
|
||||
{
|
||||
@@ -751,7 +749,7 @@ static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message");
|
||||
}
|
||||
link->errorText = strdup(emg);
|
||||
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
|
||||
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
|
||||
free(emg);
|
||||
fbcemdRelease(emd);
|
||||
fbcmdRelease(md);
|
||||
@@ -786,7 +784,7 @@ static int php_fbsql_select_db(char *databaseName, PHPFBLink *link TSRMLS_DC)
|
||||
|
||||
void phpfbestrdup(const char * s, int* length, char** value)
|
||||
{
|
||||
int l = s?strlen(s):0;
|
||||
int l = s?strlen(s):0;
|
||||
if (value)
|
||||
{
|
||||
char* r = emalloc(l+1);
|
||||
@@ -794,7 +792,7 @@ void phpfbestrdup(const char * s, int* length, char** value)
|
||||
strcpy(r, s);
|
||||
else
|
||||
r[0] = 0;
|
||||
*value = r;
|
||||
*value = r;
|
||||
}
|
||||
*length = l;
|
||||
}
|
||||
@@ -1215,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;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1290,7 +1293,7 @@ PHP_FUNCTION(fbsql_username)
|
||||
/* {{{ proto string fbsql_password(resource link_identifier [, string password])
|
||||
Get or set the user password used with a connection */
|
||||
PHP_FUNCTION(fbsql_password)
|
||||
{
|
||||
{
|
||||
PHPFBLink* phpLink = NULL;
|
||||
zval **fbsql_link_index = NULL, **password = NULL;
|
||||
|
||||
@@ -1359,17 +1362,6 @@ PHP_FUNCTION(fbsql_select_db)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
|
||||
|
||||
if (phpLink->execHandler == NULL)
|
||||
{
|
||||
int port = atoi(name);
|
||||
if (port == 0 || port > 64535) {
|
||||
if (FB_SQL_G(generateWarnings)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot connect to FBExec for database '%s'. (%s)", name, fbcehClassErrorMessage());
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!php_fbsql_select_db(name, phpLink TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1469,6 +1461,7 @@ PHP_FUNCTION(fbsql_create_db)
|
||||
convert_to_string_ex(database_name);
|
||||
databaseName = Z_STRVAL_PP(database_name);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
|
||||
if (status != FBUnknownStatus)
|
||||
{
|
||||
@@ -1542,6 +1535,7 @@ PHP_FUNCTION(fbsql_drop_db)
|
||||
convert_to_string_ex(database_name);
|
||||
databaseName = Z_STRVAL_PP(database_name);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
|
||||
if (status != FBStopped)
|
||||
{
|
||||
@@ -1616,6 +1610,7 @@ PHP_FUNCTION(fbsql_start_db)
|
||||
convert_to_string_ex(database_name);
|
||||
databaseName = Z_STRVAL_PP(database_name);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
|
||||
if ((status != FBStopped) && (status != FBRunning) && (status != FBStarting))
|
||||
{
|
||||
@@ -1752,6 +1747,7 @@ PHP_FUNCTION(fbsql_db_status)
|
||||
convert_to_string_ex(database_name);
|
||||
databaseName = Z_STRVAL_PP(database_name);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
if (phpLink->execHandler) {
|
||||
RETURN_LONG(fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName));
|
||||
}
|
||||
@@ -1795,7 +1791,7 @@ int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message");
|
||||
}
|
||||
link->errorText = strdup(emg);
|
||||
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
|
||||
link->errorNo = fbcemdErrorCodeAtIndex(emd, 0);;
|
||||
free(emg);
|
||||
fbcemdRelease(emd);
|
||||
result = 0;
|
||||
@@ -1806,7 +1802,7 @@ int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql)
|
||||
|
||||
static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
|
||||
{
|
||||
PHPFBResult* result = NULL;
|
||||
PHPFBResult* result = NULL;
|
||||
FBCMetaData* md, *meta;
|
||||
char* tp;
|
||||
char* fh;
|
||||
@@ -1827,7 +1823,7 @@ static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
|
||||
else
|
||||
md = meta;
|
||||
|
||||
tp = fbcmdStatementType(md);
|
||||
tp = fbcmdStatementType(md);
|
||||
|
||||
if ((tp[0] == 'C') || (tp[0] == 'R'))
|
||||
{
|
||||
@@ -1866,7 +1862,7 @@ static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
|
||||
fbcrhConvertToOutputCharSet(fbcdcOutputCharacterSet(link->connection), (unsigned char *)r);
|
||||
if ((result->list = fbcplParse(r)))
|
||||
{
|
||||
result->rowCount = fbcplCount(result->list);
|
||||
result->rowCount = fbcplCount(result->list);
|
||||
result->columnCount = 7;
|
||||
}
|
||||
}
|
||||
@@ -1964,7 +1960,7 @@ PHP_FUNCTION(fbsql_db_query)
|
||||
Retreive a list of all databases on the server */
|
||||
PHP_FUNCTION(fbsql_list_dbs)
|
||||
{
|
||||
PHPFBResult* phpResult;
|
||||
PHPFBResult* phpResult;
|
||||
PHPFBLink* phpLink = NULL;
|
||||
zval **fbsql_link_index = NULL;
|
||||
int id;
|
||||
@@ -1986,6 +1982,7 @@ PHP_FUNCTION(fbsql_list_dbs)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
phpResult = emalloc(sizeof(PHPFBResult));
|
||||
phpResult->link = phpLink;
|
||||
phpResult->fetchHandle = NULL;
|
||||
@@ -2053,10 +2050,10 @@ PHP_FUNCTION(fbsql_list_tables)
|
||||
PHP_FUNCTION(fbsql_list_fields)
|
||||
{
|
||||
PHPFBLink* phpLink = NULL;
|
||||
zval **fbsql_link_index = NULL, **database_name, **table_name;
|
||||
zval **fbsql_link_index = NULL, **database_name, **table_name;
|
||||
int id;
|
||||
char *databaseName, *tableName;
|
||||
char sql[1024];
|
||||
char sql[1024];
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 2:
|
||||
@@ -2160,8 +2157,8 @@ PHP_FUNCTION(fbsql_errno)
|
||||
Enable or disable FrontBase warnings */
|
||||
PHP_FUNCTION(fbsql_warnings)
|
||||
{
|
||||
int argc = ARG_COUNT(ht);
|
||||
zval **argv[1];
|
||||
int argc = ARG_COUNT(ht);
|
||||
zval **argv[1];
|
||||
|
||||
if ((argc < 0) || (argc > 1)) WRONG_PARAM_COUNT;
|
||||
if (zend_get_parameters_ex(argc, &argv[0])==FAILURE) RETURN_FALSE;
|
||||
@@ -2265,12 +2262,12 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
phpfbestrdup("True", length, value);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case FB_PrimaryKey:
|
||||
case FB_Integer:
|
||||
{
|
||||
int v = *((int*)data);
|
||||
char b[128];
|
||||
int v = *((int*)data);
|
||||
char b[128];
|
||||
sprintf(b, "%d", v);
|
||||
phpfbestrdup(b, length, value);
|
||||
}
|
||||
@@ -2278,8 +2275,8 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
#ifdef FB_TinyInteger
|
||||
case FB_TinyInteger:
|
||||
{
|
||||
short int v = *((FBTinyInteger*)data);
|
||||
char b[128];
|
||||
short int v = *((FBTinyInteger*)data);
|
||||
char b[128];
|
||||
sprintf(b, "%d", v);
|
||||
phpfbestrdup(b, length, value);
|
||||
}
|
||||
@@ -2289,7 +2286,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
case FB_LongInteger:
|
||||
{
|
||||
FBLongInteger v = *((FBLongInteger*)data);
|
||||
char b[128];
|
||||
char b[128];
|
||||
#ifdef PHP_WIN32
|
||||
sprintf(b, "%I64i", v);
|
||||
#else
|
||||
@@ -2302,7 +2299,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
case FB_SmallInteger:
|
||||
{
|
||||
short v = *((short*)data);
|
||||
char b[128];
|
||||
char b[128];
|
||||
sprintf(b, "%d", v);
|
||||
phpfbestrdup(b, length, value);
|
||||
}
|
||||
@@ -2315,7 +2312,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
case FB_Decimal:
|
||||
{
|
||||
double v = *((double*)data);
|
||||
char b[128];
|
||||
char b[128];
|
||||
sprintf(b, "%f", v);
|
||||
phpfbestrdup(b, length, value);
|
||||
}
|
||||
@@ -2332,13 +2329,13 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
case FB_Bit:
|
||||
case FB_VBit:
|
||||
{
|
||||
const FBCColumnMetaData* clmd = fbcmdColumnMetaDataAtIndex(md, column);
|
||||
const FBCColumnMetaData* clmd = fbcmdColumnMetaDataAtIndex(md, column);
|
||||
struct bitValue
|
||||
{
|
||||
unsigned int nBytes;
|
||||
unsigned int nBytes;
|
||||
unsigned char* bytes;
|
||||
};
|
||||
struct bitValue* ptr = data;
|
||||
struct bitValue* ptr = data;
|
||||
unsigned nBits = ptr->nBytes * 8;
|
||||
|
||||
if (dtc == FB_Bit) nBits = fbcdmdLength(fbccmdDatatype(clmd));
|
||||
@@ -2349,7 +2346,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
*length = l*2+3+1;
|
||||
if (value)
|
||||
{
|
||||
char* r = emalloc(l*2+3+1);
|
||||
char* r = emalloc(l*2+3+1);
|
||||
r[0] = 'X';
|
||||
r[1] = '\'';
|
||||
for (i = 0; i < nBits / 8; i++)
|
||||
@@ -2361,7 +2358,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
}
|
||||
r[i*2+2] = '\'';
|
||||
r[i*2+3] = 0;
|
||||
*value = r;
|
||||
*value = r;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2371,7 +2368,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
*length = l*2+3+1;
|
||||
if (value)
|
||||
{
|
||||
char* r = emalloc(l*2+3+1);
|
||||
char* r = emalloc(l*2+3+1);
|
||||
r[0] = 'B';
|
||||
r[1] = '\'';
|
||||
for (i = 0; i < nBits; i++)
|
||||
@@ -2382,7 +2379,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
}
|
||||
r[i*2+2] = '\'';
|
||||
r[i*2+3] = 0;
|
||||
*value = r;
|
||||
*value = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2402,7 +2399,7 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
case FB_YearMonth:
|
||||
{
|
||||
char b[128];
|
||||
int v = *((unsigned int*)data);
|
||||
int v = *((unsigned int*)data);
|
||||
sprintf(b, "%d", v);
|
||||
phpfbestrdup(b, length, value);
|
||||
}
|
||||
@@ -2455,14 +2452,14 @@ void phpfbColumnAsString(PHPFBResult* result, int column, void* data , int* leng
|
||||
|
||||
/* {{{ phpfbSqlResult
|
||||
*/
|
||||
void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIndex, int columnIndex)
|
||||
void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIndex, int columnIndex)
|
||||
{
|
||||
void** row;
|
||||
if (result->list)
|
||||
{
|
||||
FBCPList* columns = (FBCPList*)fbcplValueForKey(result->list, "COLUMNS");
|
||||
FBCPList* column = (FBCPList*)fbcplValueAtIndex(columns, result->rowIndex);
|
||||
if (columnIndex == 0)
|
||||
if (columnIndex == 0)
|
||||
{ /* Name */
|
||||
FBCPList* name = (FBCPList*)fbcplValueForKey(column, "NAME");
|
||||
RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
|
||||
@@ -2521,7 +2518,7 @@ void phpfbSqlResult(INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIn
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto mixed fbsql_result(int result [, int row [, mixed field]])
|
||||
??? */
|
||||
PHP_FUNCTION(fbsql_result)
|
||||
@@ -2560,7 +2557,7 @@ PHP_FUNCTION(fbsql_result)
|
||||
rowIndex = Z_LVAL_PP(row);
|
||||
}
|
||||
|
||||
columnIndex = result->columnIndex;
|
||||
columnIndex = result->columnIndex;
|
||||
if (field)
|
||||
{
|
||||
if ((Z_TYPE_PP(field) == IS_STRING) && (result->metaData))
|
||||
@@ -2584,8 +2581,8 @@ PHP_FUNCTION(fbsql_result)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU, result, rowIndex, columnIndex);
|
||||
|
||||
result->columnIndex++;
|
||||
@@ -2616,9 +2613,9 @@ PHP_FUNCTION(fbsql_next_result)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
|
||||
|
||||
result->currentResult++;
|
||||
result->currentResult++;
|
||||
if (result->currentResult < result->selectResults) {
|
||||
if (result->fetchHandle) {
|
||||
if (result->fetchHandle) {
|
||||
FBCMetaData *md = fbcdcCancelFetch(result->link->connection, result->fetchHandle);
|
||||
fbcmdRelease(md);
|
||||
}
|
||||
@@ -2927,7 +2924,7 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
||||
{
|
||||
if (row[i])
|
||||
{
|
||||
char* value;
|
||||
char* value;
|
||||
unsigned int length;
|
||||
unsigned int c = 0;
|
||||
phpfbColumnAsString(result, i, row[i], &length, &value TSRMLS_CC);
|
||||
@@ -3023,7 +3020,7 @@ PHP_FUNCTION(fbsql_fetch_lengths)
|
||||
if (array_init(return_value)==FAILURE) RETURN_FALSE;
|
||||
for (i=0; i < result->columnCount; i++)
|
||||
{
|
||||
unsigned length = 0;
|
||||
unsigned length = 0;
|
||||
if (result->row[i]) phpfbColumnAsString(result, i, result->row[i], &length, NULL TSRMLS_CC);
|
||||
add_index_long(return_value, i, length);
|
||||
}
|
||||
@@ -3414,9 +3411,9 @@ PHP_FUNCTION(fbsql_field_flags)
|
||||
PHP_FUNCTION(fbsql_table_name)
|
||||
{
|
||||
PHPFBResult* result = NULL;
|
||||
zval **fbsql_result_index = NULL, **table_index;
|
||||
zval **fbsql_result_index = NULL, **table_index;
|
||||
unsigned index;
|
||||
char* value;
|
||||
char* value;
|
||||
unsigned int length;
|
||||
void** row;
|
||||
|
||||
@@ -3502,6 +3499,7 @@ PHP_FUNCTION(fbsql_get_autostart_info)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
|
||||
|
||||
if (phpLink->execHandler == NULL) phpLink->execHandler = fbcehHandlerForHost(phpLink->hostName, 128);
|
||||
if (phpLink->execHandler == NULL) {
|
||||
if (FB_SQL_G(generateWarnings))
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No valid Exec handler available for this connection");
|
||||
|
||||
@@ -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);
|
||||
@@ -1481,6 +1485,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)) {
|
||||
|
||||
+45
-28
@@ -108,7 +108,7 @@ static char** ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRM
|
||||
|
||||
/* IP and port conversion box */
|
||||
union ipbox {
|
||||
unsigned long l[2];
|
||||
struct in_addr ia[2];
|
||||
unsigned short s[4];
|
||||
unsigned char c[8];
|
||||
};
|
||||
@@ -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);
|
||||
@@ -638,9 +641,8 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
|
||||
sin = (struct sockaddr_in *) sa;
|
||||
sin->sin_family = AF_INET;
|
||||
sin->sin_addr.s_addr = ipbox.l[0];
|
||||
sin->sin_addr = ipbox.ia[0];
|
||||
sin->sin_port = ipbox.s[2];
|
||||
|
||||
ftp->pasv = 2;
|
||||
|
||||
return 1;
|
||||
@@ -653,7 +655,6 @@ int
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int lastch;
|
||||
size_t rcvd;
|
||||
char arg[11];
|
||||
@@ -704,12 +705,39 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
}
|
||||
|
||||
if (type == FTPTYPE_ASCII) {
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
if (lastch == '\r' && *ptr != '\n')
|
||||
char *s;
|
||||
char *ptr = data->buf;
|
||||
char *e = ptr + rcvd;
|
||||
/* logic depends on the OS EOL
|
||||
* Win32 -> \r\n
|
||||
* Everything Else \n
|
||||
*/
|
||||
#ifdef PHP_WIN32
|
||||
while ((s = strpbrk(ptr, "\r\n"))) {
|
||||
if (*s == '\n') {
|
||||
php_stream_putc(outstream, '\r');
|
||||
if (*ptr != '\r')
|
||||
php_stream_putc(outstream, *ptr);
|
||||
lastch = *ptr;
|
||||
} else if (*s == '\r' && *(s + 1) == '\n') {
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
php_stream_write(outstream, ptr, (s - ptr));
|
||||
if (*(s - 1) == '\r') {
|
||||
php_stream_putc(outstream, '\n');
|
||||
}
|
||||
ptr = s;
|
||||
}
|
||||
#else
|
||||
while ((s = memchr(ptr, '\r', (e - ptr)))) {
|
||||
php_stream_write(outstream, ptr, (s - ptr));
|
||||
if (*(s + 1) == '\n') {
|
||||
s++;
|
||||
}
|
||||
php_stream_putc(outstream, '\n');
|
||||
ptr = s + 1;
|
||||
}
|
||||
#endif
|
||||
if (ptr < e) {
|
||||
php_stream_write(outstream, ptr, (e - ptr));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -718,9 +746,6 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
}
|
||||
}
|
||||
|
||||
if (type == FTPTYPE_ASCII && lastch == '\r')
|
||||
php_stream_putc(outstream, '\r');
|
||||
|
||||
ftp->data = data = data_close(ftp, data);
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
@@ -1328,7 +1353,7 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
|
||||
#endif
|
||||
|
||||
/* send the PORT */
|
||||
ipbox.l[0] = ((struct sockaddr_in*) sa)->sin_addr.s_addr;
|
||||
ipbox.ia[0] = ((struct sockaddr_in*) sa)->sin_addr;
|
||||
ipbox.s[2] = ((struct sockaddr_in*) &addr)->sin_port;
|
||||
sprintf(arg, "%u,%u,%u,%u,%u,%u",
|
||||
ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3],
|
||||
@@ -1454,7 +1479,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
char**
|
||||
ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
{
|
||||
FILE *tmpfp = NULL;
|
||||
php_stream *tmpstream = NULL;
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int ch, lastch;
|
||||
@@ -1464,7 +1489,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
char **entry;
|
||||
char *text;
|
||||
|
||||
if ((tmpfp = tmpfile()) == NULL) {
|
||||
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create temporary file. Check permissions in temporary files directory.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1492,7 +1517,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if (rcvd == -1)
|
||||
goto bail;
|
||||
|
||||
fwrite(data->buf, rcvd, 1, tmpfp);
|
||||
php_stream_write(tmpstream, data->buf, rcvd);
|
||||
|
||||
size += rcvd;
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
@@ -1506,12 +1531,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
|
||||
ftp->data = data = data_close(ftp, data);
|
||||
|
||||
if (ferror(tmpfp))
|
||||
goto bail;
|
||||
|
||||
|
||||
|
||||
rewind(tmpfp);
|
||||
php_stream_rewind(tmpstream);
|
||||
|
||||
ret = emalloc((lines + 1) * sizeof(char**) + size * sizeof(char*));
|
||||
|
||||
@@ -1519,7 +1539,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
text = (char*) (ret + lines + 1);
|
||||
*entry = text;
|
||||
lastch = 0;
|
||||
while ((ch = getc(tmpfp)) != EOF) {
|
||||
while ((ch = php_stream_getc(tmpstream)) != EOF) {
|
||||
if (ch == '\n' && lastch == '\r') {
|
||||
*(text - 1) = 0;
|
||||
*++entry = text;
|
||||
@@ -1531,10 +1551,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
}
|
||||
*entry = NULL;
|
||||
|
||||
if (ferror(tmpfp))
|
||||
goto bail;
|
||||
|
||||
fclose(tmpfp);
|
||||
php_stream_close(tmpstream);
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
efree(ret);
|
||||
@@ -1544,7 +1561,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
return ret;
|
||||
bail:
|
||||
ftp->data = data_close(ftp, data);
|
||||
fclose(tmpfp);
|
||||
php_stream_close(tmpstream);
|
||||
if (ret)
|
||||
efree(ret);
|
||||
return NULL;
|
||||
|
||||
+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"
|
||||
|
||||
+33
-7
@@ -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,10 +1622,17 @@ 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<0||q>255) {
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
} else if (q < 0 || q > 255) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
|
||||
q = 0;
|
||||
}
|
||||
gdImageWBMP(im, q, fp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, fp, q);
|
||||
break;
|
||||
@@ -1651,17 +1664,24 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
FILE *tmp;
|
||||
char buf[4096];
|
||||
|
||||
tmp = tmpfile();
|
||||
tmp = php_open_temporary_file("", "", NULL 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<0||q>255) {
|
||||
if (q == -1) {
|
||||
q = 0;
|
||||
} else if (q < 0 || q > 255) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
|
||||
q = 0;
|
||||
}
|
||||
gdImageWBMP(im, q, tmp);
|
||||
break;
|
||||
#endif
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
(*func_p)(im, tmp, q);
|
||||
break;
|
||||
@@ -3625,6 +3645,12 @@ 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++) {
|
||||
color_org = gdImageGetPixel (im_org, x, y);
|
||||
|
||||
+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"
|
||||
|
||||
+47
-19
@@ -571,7 +571,7 @@ void gdImageColorTransparent (gdImagePtr im, int color)
|
||||
if (im->transparent != -1) {
|
||||
im->alpha[im->transparent] = gdAlphaOpaque;
|
||||
}
|
||||
if (color > -1 && color<=gdMaxColors) {
|
||||
if (color > -1 && color<im->colorsTotal && color<=gdMaxColors) {
|
||||
im->alpha[color] = gdAlphaTransparent;
|
||||
} else {
|
||||
return;
|
||||
@@ -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;
|
||||
@@ -1762,13 +1771,18 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
int lastBorder;
|
||||
/* Seek left */
|
||||
int leftLimit = -1, rightLimit;
|
||||
int i;
|
||||
int i, restoreAlphaBleding=0;
|
||||
|
||||
if (border < 0) {
|
||||
/* Refuse to fill to a non-solid border */
|
||||
return;
|
||||
}
|
||||
|
||||
if (im->alphaBlendingFlag) {
|
||||
restoreAlphaBleding = 1;
|
||||
im->alphaBlendingFlag = 0;
|
||||
}
|
||||
|
||||
if (x >= im->sx) {
|
||||
x = im->sx - 1;
|
||||
}
|
||||
@@ -1784,6 +1798,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
leftLimit = i;
|
||||
}
|
||||
if (leftLimit == -1) {
|
||||
if (restoreAlphaBleding) {
|
||||
im->alphaBlendingFlag = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* Seek right */
|
||||
@@ -1827,6 +1844,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (restoreAlphaBleding) {
|
||||
im->alphaBlendingFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1859,13 +1879,18 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1911,6 +1936,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)
|
||||
@@ -2281,7 +2307,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 {
|
||||
@@ -2289,7 +2316,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;
|
||||
}
|
||||
}
|
||||
@@ -2345,22 +2373,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) {
|
||||
@@ -2372,12 +2402,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
|
||||
}
|
||||
|
||||
+27
-8
@@ -62,7 +62,7 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
|
||||
#include "gdcache.h"
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include "freetype/ftglyph.h"
|
||||
#include FT_GLYPH_H
|
||||
|
||||
/* number of fonts cached before least recently used is replaced */
|
||||
#define FONTCACHESIZE 6
|
||||
@@ -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";
|
||||
@@ -965,7 +984,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
}
|
||||
|
||||
/* EAM DEBUG */
|
||||
#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 (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
|
||||
/* I do not know the significance of the constant 0xf000.
|
||||
* It was determined by inspection of the character codes
|
||||
@@ -975,7 +994,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
|
||||
ch |= 0xf000;
|
||||
next += len;
|
||||
} else
|
||||
#endif /* FT_ENCODING_MS_SYMBOL */
|
||||
#endif /* Freetype 2.1 or better */
|
||||
/* EAM DEBUG */
|
||||
|
||||
switch (m) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
gdimagefill() function (Bug #19366 (fixed in bundled libgd))
|
||||
--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
|
||||
/* $id$ */
|
||||
$dest = dirname(realpath(__FILE__)) . 'bug27582.png';
|
||||
@unlink($dest);
|
||||
$im = ImageCreateTrueColor(10, 10);
|
||||
imagealphablending($im, true);
|
||||
imagesavealpha($im, false);
|
||||
$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
|
||||
$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
|
||||
ImageFillToBorder($im, 5, 5, $bordercolor, $color);
|
||||
imagepng($im, $dest);
|
||||
echo md5_file($dest) . "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
08287f8f5d406946009df5f04ca83dc0
|
||||
@@ -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$
|
||||
|
||||
|
||||
+13
-1
@@ -309,6 +309,10 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
|
||||
FETCH_GMP_ZVAL(gmpnum_b, b_arg);
|
||||
}
|
||||
|
||||
if (!Z_LVAL_PP(b_arg)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INIT_GMP_NUM(gmpnum_result);
|
||||
if(use_ui && gmp_ui_op) {
|
||||
if(allow_ui_return) {
|
||||
@@ -348,6 +352,10 @@ static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, z
|
||||
FETCH_GMP_ZVAL(gmpnum_b, b_arg);
|
||||
}
|
||||
|
||||
if (!Z_LVAL_PP(b_arg)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INIT_GMP_NUM(gmpnum_result1);
|
||||
INIT_GMP_NUM(gmpnum_result2);
|
||||
|
||||
@@ -822,6 +830,10 @@ ZEND_FUNCTION(gmp_powm)
|
||||
}
|
||||
FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
|
||||
|
||||
if (!mpz_cmp_ui(*gmpnum_mod, 0)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
INIT_GMP_NUM(gmpnum_result);
|
||||
if(use_ui) {
|
||||
mpz_powm_ui(*gmpnum_result, *gmpnum_base, (unsigned long)Z_LVAL_PP(exp_arg), *gmpnum_mod);
|
||||
@@ -1219,7 +1231,7 @@ ZEND_FUNCTION(gmp_hamdist)
|
||||
zval **a_arg, **b_arg;
|
||||
mpz_t *gmpnum_a, *gmpnum_b;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &a_arg, &b_arg) == FAILURE){
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+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 */
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
InterBase
|
||||
Jouni Ahto, Andrew Avdeev
|
||||
Jouni Ahto, Andrew Avdeev, Ard Biesheuvel
|
||||
+36
-28
@@ -945,7 +945,7 @@ PHP_FUNCTION(ibase_connect)
|
||||
Open a persistent connection to an InterBase database */
|
||||
PHP_FUNCTION(ibase_pconnect)
|
||||
{
|
||||
_php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
_php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, IBG(allow_persistent));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -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,11 +1209,17 @@ 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;
|
||||
|
||||
if (Z_TYPE_P(b_var) == IS_NULL) {
|
||||
|
||||
if ((var->sqltype & 1) != 1) {
|
||||
_php_ibase_module_error("Parameter %d must have a value" TSRMLS_CC, i+1);
|
||||
rv = FAILURE;
|
||||
}
|
||||
|
||||
buf[i].sqlind = -1;
|
||||
} else {
|
||||
buf[i].sqlind = 0;
|
||||
@@ -1419,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 */
|
||||
@@ -1693,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;
|
||||
@@ -1736,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 */
|
||||
@@ -1836,32 +1842,34 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, int sca
|
||||
}
|
||||
break;
|
||||
#ifdef SQL_INT64
|
||||
case SQL_INT64:
|
||||
case SQL_INT64: {
|
||||
ISC_INT64 n = *(ISC_INT64 *) data;
|
||||
Z_TYPE_P(val) = IS_STRING;
|
||||
if (scale < 0 ){
|
||||
short j = 0;
|
||||
ISC_INT64 n, f = 1;
|
||||
n = (ISC_INT64) *(ISC_INT64 *) data;
|
||||
for (j = 0; j < -scale; j++) {
|
||||
|
||||
if (scale < 0) {
|
||||
short j;
|
||||
ISC_INT64 f = 1;
|
||||
|
||||
for (j = 0; j < -scale; ++j) {
|
||||
f *= 10;
|
||||
}
|
||||
if ( n >= 0){
|
||||
Z_STRLEN_P(val) = sprintf (string_data, "%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d",
|
||||
(ISC_INT64) n / f, -scale, (ISC_INT64) n % f );
|
||||
}else if ((n/f) != 0 ){
|
||||
Z_STRLEN_P(val) = sprintf (string_data, "%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d",
|
||||
(ISC_INT64) n / f, -scale, (ISC_INT64) -(n % f) );
|
||||
}else{
|
||||
Z_STRLEN_P(val) = sprintf (string_data, "%s.%0*" ISC_INT64_FORMAT "d",
|
||||
"-0", -scale, (ISC_INT64) -(n % f) );
|
||||
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) {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"%" ISC_INT64_FORMAT "d.%0*" ISC_INT64_FORMAT "d", n / f, -scale, -n % f);
|
||||
} else {
|
||||
Z_STRLEN_P(val) = sprintf (string_data,
|
||||
"-0.%0*" ISC_INT64_FORMAT "d", -scale, -n % f);
|
||||
}
|
||||
} else {
|
||||
Z_STRLEN_P(val) =sprintf (string_data, "%.0" ISC_INT64_FORMAT "d",
|
||||
(ISC_INT64) *(ISC_INT64 *) data);
|
||||
Z_STRLEN_P(val) = sprintf (string_data, "%" ISC_INT64_FORMAT "d", n);
|
||||
}
|
||||
|
||||
Z_STRVAL_P(val) = estrdup(string_data);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifndef SQL_TIMESTAMP
|
||||
case SQL_DATE:
|
||||
@@ -2315,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;
|
||||
|
||||
@@ -2334,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? */
|
||||
|
||||
@@ -7,21 +7,21 @@ InterBase: connect, close and pconnect
|
||||
--FILE--
|
||||
<?php /* $Id$ */
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
ibase_connect($test_base);
|
||||
out_table("test1");
|
||||
ibase_close();
|
||||
require("interbase.inc");
|
||||
|
||||
$con = ibase_connect($test_base);
|
||||
$pcon1 = ibase_pconnect($test_base);
|
||||
$pcon2 = ibase_pconnect($test_base);
|
||||
ibase_close($con);
|
||||
ibase_close($pcon1);
|
||||
ibase_connect($test_base);
|
||||
out_table("test1");
|
||||
ibase_close();
|
||||
|
||||
out_table("test1");
|
||||
$con = ibase_connect($test_base);
|
||||
$pcon1 = ibase_pconnect($test_base);
|
||||
$pcon2 = ibase_pconnect($test_base);
|
||||
ibase_close($con);
|
||||
ibase_close($pcon1);
|
||||
|
||||
ibase_close($pcon2);
|
||||
out_table("test1");
|
||||
|
||||
ibase_close($pcon2);
|
||||
?>
|
||||
--EXPECT--
|
||||
--- test1 ---
|
||||
|
||||
+121
-116
@@ -5,127 +5,132 @@ InterBase: misc sql types (may take a while)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
<?php /* $Id$ */
|
||||
|
||||
require("interbase.inc");
|
||||
ibase_connect($test_base);
|
||||
|
||||
ibase_query(
|
||||
"create table test3 (
|
||||
iter integer,
|
||||
v_char char(1000),
|
||||
v_date timestamp,
|
||||
v_decimal4_2 decimal(4,2),
|
||||
v_decimal4_0 decimal(4,0),
|
||||
v_decimal7_2 decimal(7,2),
|
||||
v_decimal7_0 decimal(7,0),
|
||||
v_numeric15_15 numeric(15,15),
|
||||
v_numeric15_0 numeric(15,0),
|
||||
v_double double precision,
|
||||
v_float float,
|
||||
v_integer integer,
|
||||
v_smallint smallint,
|
||||
v_varchar varchar(10000)
|
||||
)");
|
||||
ibase_commit();
|
||||
require("interbase.inc");
|
||||
|
||||
/* if timefmt is not supported, suppress error here */
|
||||
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
|
||||
ibase_connect($test_base);
|
||||
|
||||
for($iter = 0; $iter < 10; $iter++){
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal4_2 = rand_number(4,2);
|
||||
$v_decimal4_0 = rand_number(4,0);
|
||||
$v_decimal7_2 = rand_number(7,2);
|
||||
$v_decimal7_0 = rand_number(7,0);
|
||||
$v_numeric15_15 = rand_number(15,15);
|
||||
$v_numeric15_0 = rand_number(15,0);
|
||||
$v_double = rand_number(18);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
ibase_query(
|
||||
"CREATE TABLE test3 (
|
||||
iter integer not null,
|
||||
v_char char(1000),
|
||||
v_date timestamp,
|
||||
v_decimal4_2 decimal(4,2),
|
||||
v_decimal4_0 decimal(4,0),
|
||||
v_decimal7_2 decimal(7,2),
|
||||
v_decimal7_0 decimal(7,0),
|
||||
v_numeric15_15 numeric(15,15),
|
||||
v_numeric15_0 numeric(15,0),
|
||||
v_double double precision,
|
||||
v_float float,
|
||||
v_integer integer,
|
||||
v_smallint smallint,
|
||||
v_varchar varchar(10000)
|
||||
)");
|
||||
ibase_commit();
|
||||
|
||||
ibase_query(
|
||||
"insert into test3 (iter, v_char,v_date,v_decimal4_2, v_decimal4_0, v_decimal7_2, v_decimal7_0,v_numeric15_15, v_numeric15_0,v_double,v_float,v_integer,v_smallint,v_varchar)
|
||||
values ($iter, '$v_char','$v_date',$v_decimal4_2, $v_decimal4_0, $v_decimal7_2, $v_decimal7_0,$v_numeric15_15, $v_numeric15_0,$v_double,$v_float,$v_integer,$v_smallint,'$v_varchar')");
|
||||
$sel = ibase_query("select * from test3 where iter = $iter");
|
||||
$row = ibase_fetch_object($sel);
|
||||
if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
|
||||
echo " CHAR fail:\n";
|
||||
echo " in: $v_char\n";
|
||||
echo " out: $row->V_CHAR\n";
|
||||
}
|
||||
if($row->V_DATE != $v_date){
|
||||
echo " DATE fail\n";
|
||||
echo " in: $v_date\n";
|
||||
echo " out: $row->V_DATE\n";
|
||||
}
|
||||
if($row->V_DECIMAL4_2 != $v_decimal4_2){
|
||||
echo " DECIMAL4_2 fail\n";
|
||||
echo " in: $v_decimal4_2\n";
|
||||
echo " out: $row->V_DECIMAL4_2\n";
|
||||
}
|
||||
if($row->V_DECIMAL4_0 != $v_decimal4_0){
|
||||
echo " DECIMAL4_0 fail\n";
|
||||
echo " in: $v_decimal4_0\n";
|
||||
echo " out: $row->V_DECIMAL4_0\n";
|
||||
}
|
||||
if($row->V_DECIMAL7_2 != $v_decimal7_2){
|
||||
echo " DECIMAL7_2 fail\n";
|
||||
echo " in: $v_decimal7_2\n";
|
||||
echo " out: $row->V_DECIMAL7_2\n";
|
||||
}
|
||||
if($row->V_DECIMAL7_0 != $v_decimal7_0){
|
||||
echo " DECIMAL7_0 fail\n";
|
||||
echo " in: $v_decimal7_0\n";
|
||||
echo " out: $row->V_DECIMAL7_0\n";
|
||||
}
|
||||
if($row->V_NUMERIC15_15 != $v_numeric15_15){
|
||||
echo " NUMERIC15_15 fail\n";
|
||||
echo " in: $v_numeric15_15\n";
|
||||
echo " out: $row->V_NUMERIC15_15\n";
|
||||
}
|
||||
if($row->V_NUMERIC15_0 != $v_numeric15_0){
|
||||
echo " NUMERIC15_0 fail\n";
|
||||
echo " in: $v_numeric15_0\n";
|
||||
echo " out: $row->V_NUMERIC15_0\n";
|
||||
}
|
||||
|
||||
if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
|
||||
echo " DOUBLE fail\n";
|
||||
echo " in: $v_double\n";
|
||||
echo " out: $row->V_DOUBLE\n";
|
||||
}
|
||||
if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
|
||||
echo " FLOAT fail\n";
|
||||
echo " in: $v_float\n";
|
||||
echo " out: $row->V_FLOAT\n";
|
||||
}
|
||||
if($row->V_INTEGER != $v_integer){
|
||||
echo " INTEGER fail\n";
|
||||
echo " in: $v_integer\n";
|
||||
echo " out: $row->V_INTEGER\n";
|
||||
}
|
||||
if($row->V_SMALLINT != $v_smallint){
|
||||
echo " SMALLINT fail\n";
|
||||
echo " in: $v_smallint\n";
|
||||
echo " out: $row->V_SMALLINT\n";
|
||||
}
|
||||
|
||||
if(substr($row->V_VARCHAR,0,strlen($v_varchar)) != $v_varchar){
|
||||
echo " VARCHAR fail:\n";
|
||||
echo " in: $v_varchar\n";
|
||||
echo " out: $row->V_VARCHAR\n";
|
||||
}
|
||||
|
||||
ibase_free_result($sel);
|
||||
} /* for($iter) */
|
||||
/* should fail, but gracefully */
|
||||
@ibase_query("INSERT INTO test3 (iter) VALUES (?)", null);
|
||||
|
||||
ibase_close();
|
||||
echo "end of test\n";
|
||||
/* if timefmt is not supported, suppress error here */
|
||||
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
|
||||
|
||||
for ($iter = 0; $iter < 10; ++$iter) {
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal4_2 = rand_number(4,2);
|
||||
$v_decimal4_0 = rand_number(4,0);
|
||||
$v_decimal7_2 = rand_number(7,2);
|
||||
$v_decimal7_0 = rand_number(7,0);
|
||||
$v_numeric15_15 = rand_number(15,15);
|
||||
$v_numeric15_0 = $iter ? rand_number(15,0) : 0;
|
||||
$v_double = rand_number(18);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
|
||||
ibase_query(
|
||||
"INSERT INTO test3 (iter, v_char,v_date,v_decimal4_2, v_decimal4_0, v_decimal7_2, v_decimal7_0,
|
||||
v_numeric15_15, v_numeric15_0,v_double,v_float,v_integer,v_smallint,v_varchar)
|
||||
VALUES ($iter, '$v_char','$v_date',$v_decimal4_2, $v_decimal4_0, $v_decimal7_2, $v_decimal7_0,
|
||||
$v_numeric15_15, $v_numeric15_0,$v_double,$v_float,$v_integer,$v_smallint,'$v_varchar')");
|
||||
|
||||
$sel = ibase_query('SELECT * FROM test3 WHERE iter = ?',$iter);
|
||||
$row = ibase_fetch_object($sel);
|
||||
if (substr($row->V_CHAR,0,strlen($v_char)) != $v_char) {
|
||||
echo " CHAR fail:\n";
|
||||
echo " in: $v_char\n";
|
||||
echo " out: $row->V_CHAR\n";
|
||||
}
|
||||
if ($row->V_DATE != $v_date) {
|
||||
echo " DATE fail\n";
|
||||
echo " in: $v_date\n";
|
||||
echo " out: $row->V_DATE\n";
|
||||
}
|
||||
if ($row->V_DECIMAL4_2 != $v_decimal4_2) {
|
||||
echo " DECIMAL4_2 fail\n";
|
||||
echo " in: $v_decimal4_2\n";
|
||||
echo " out: $row->V_DECIMAL4_2\n";
|
||||
}
|
||||
if ($row->V_DECIMAL4_0 != $v_decimal4_0) {
|
||||
echo " DECIMAL4_0 fail\n";
|
||||
echo " in: $v_decimal4_0\n";
|
||||
echo " out: $row->V_DECIMAL4_0\n";
|
||||
}
|
||||
if ($row->V_DECIMAL7_2 != $v_decimal7_2) {
|
||||
echo " DECIMAL7_2 fail\n";
|
||||
echo " in: $v_decimal7_2\n";
|
||||
echo " out: $row->V_DECIMAL7_2\n";
|
||||
}
|
||||
if ($row->V_DECIMAL7_0 != $v_decimal7_0) {
|
||||
echo " DECIMAL7_0 fail\n";
|
||||
echo " in: $v_decimal7_0\n";
|
||||
echo " out: $row->V_DECIMAL7_0\n";
|
||||
}
|
||||
if ($row->V_NUMERIC15_15 != $v_numeric15_15) {
|
||||
echo " NUMERIC15_15 fail\n";
|
||||
echo " in: $v_numeric15_15\n";
|
||||
echo " out: $row->V_NUMERIC15_15\n";
|
||||
}
|
||||
if ($row->V_NUMERIC15_0 != (string)$v_numeric15_0) {
|
||||
echo " NUMERIC15_0 fail\n";
|
||||
echo " in: $v_numeric15_0\n";
|
||||
echo " out: $row->V_NUMERIC15_0\n";
|
||||
}
|
||||
if (abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)) {
|
||||
echo " DOUBLE fail\n";
|
||||
echo " in: $v_double\n";
|
||||
echo " out: $row->V_DOUBLE\n";
|
||||
}
|
||||
if (abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)) {
|
||||
echo " FLOAT fail\n";
|
||||
echo " in: $v_float\n";
|
||||
echo " out: $row->V_FLOAT\n";
|
||||
}
|
||||
if ($row->V_INTEGER != $v_integer) {
|
||||
echo " INTEGER fail\n";
|
||||
echo " in: $v_integer\n";
|
||||
echo " out: $row->V_INTEGER\n";
|
||||
}
|
||||
if ($row->V_SMALLINT != $v_smallint) {
|
||||
echo " SMALLINT fail\n";
|
||||
echo " in: $v_smallint\n";
|
||||
echo " out: $row->V_SMALLINT\n";
|
||||
}
|
||||
if (substr($row->V_VARCHAR,0,strlen($v_varchar)) != $v_varchar) {
|
||||
echo " VARCHAR fail:\n";
|
||||
echo " in: $v_varchar\n";
|
||||
echo " out: $row->V_VARCHAR\n";
|
||||
}
|
||||
|
||||
ibase_free_result($sel);
|
||||
} /* for($iter) */
|
||||
|
||||
ibase_close();
|
||||
echo "end of test\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
end of test
|
||||
@@ -5,116 +5,118 @@ InterBase: BLOB test
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
<?php /* $Id$ */
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
ibase_connect($test_base);
|
||||
require("interbase.inc");
|
||||
|
||||
ibase_query(
|
||||
"create table test4 (
|
||||
v_integer integer,
|
||||
v_blob blob)");
|
||||
ibase_commit();
|
||||
ibase_connect($test_base);
|
||||
|
||||
/* create 100k blob file */
|
||||
$blob_str = rand_binstr(100*1024);
|
||||
ibase_query(
|
||||
"CREATE TABLE test4 (
|
||||
v_integer integer,
|
||||
v_blob blob)");
|
||||
ibase_commit();
|
||||
|
||||
$name = tempnam(dirname(__FILE__),"blob.tmp");
|
||||
$ftmp = fopen($name,"w");
|
||||
fwrite($ftmp,$blob_str);
|
||||
fclose($ftmp);
|
||||
/* create 100k blob file */
|
||||
$blob_str = rand_binstr(100*1024);
|
||||
|
||||
echo "import blob 1\n";
|
||||
$ftmp = fopen($name,"r");
|
||||
$bl_s = ibase_blob_import($ftmp);
|
||||
ibase_query("insert into test4 (v_integer, v_blob) values (1, ?)", $bl_s);
|
||||
$name = tempnam(dirname(__FILE__),"blob.tmp");
|
||||
$ftmp = fopen($name,"w");
|
||||
fwrite($ftmp,$blob_str);
|
||||
fclose($ftmp);
|
||||
|
||||
echo "test blob 1\n";
|
||||
$q = ibase_query("select v_blob from test4 where v_integer = 1");
|
||||
$row = ibase_fetch_object($q);
|
||||
$bl_h = ibase_blob_open($row->V_BLOB);
|
||||
echo "import blob 1\n";
|
||||
|
||||
$blob = '';
|
||||
while($piece = ibase_blob_get($bl_h, 1 + rand() % 1024))
|
||||
$blob .= $piece;
|
||||
if($blob != $blob_str)
|
||||
echo " BLOB 1 fail (1)\n";
|
||||
ibase_blob_close($bl_h);
|
||||
$ftmp = fopen($name,"r");
|
||||
$bl_s = ibase_blob_import($ftmp);
|
||||
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (1, ?)", $bl_s);
|
||||
|
||||
$bl_h = ibase_blob_open($row->V_BLOB);
|
||||
echo "test blob 1\n";
|
||||
|
||||
$blob = '';
|
||||
while($piece = ibase_blob_get($bl_h, 100 * 1024))
|
||||
$blob .= $piece;
|
||||
if($blob != $blob_str)
|
||||
echo " BLOB 1 fail (2)\n";
|
||||
ibase_blob_close($bl_h);
|
||||
ibase_free_result($q);
|
||||
unset($blob);
|
||||
$q = ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 1");
|
||||
$row = ibase_fetch_object($q);
|
||||
$bl_h = ibase_blob_open($row->V_BLOB);
|
||||
|
||||
echo "create blob 2\n";
|
||||
$blob = '';
|
||||
while ($piece = ibase_blob_get($bl_h, 1 + rand() % 1024))
|
||||
$blob .= $piece;
|
||||
if ($blob != $blob_str)
|
||||
echo " BLOB 1 fail (1)\n";
|
||||
ibase_blob_close($bl_h);
|
||||
|
||||
ibase_query("insert into test4 (v_integer, v_blob) values (2, ?)", $blob_str);
|
||||
$bl_h = ibase_blob_open($row->V_BLOB);
|
||||
|
||||
echo "test blob 2\n";
|
||||
$blob = '';
|
||||
while ($piece = ibase_blob_get($bl_h, 100 * 1024))
|
||||
$blob .= $piece;
|
||||
if ($blob != $blob_str)
|
||||
echo " BLOB 1 fail (2)\n";
|
||||
ibase_blob_close($bl_h);
|
||||
ibase_free_result($q);
|
||||
unset($blob);
|
||||
|
||||
$q = ibase_query("select v_blob from test4 where v_integer = 2");
|
||||
$row = ibase_fetch_object($q,IBASE_TEXT);
|
||||
echo "create blob 2\n";
|
||||
|
||||
if($row->V_BLOB != $blob_str)
|
||||
echo " BLOB 2 fail\n";
|
||||
ibase_free_result($q);
|
||||
unset($blob);
|
||||
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (2, ?)", $blob_str);
|
||||
|
||||
echo "test blob 2\n";
|
||||
|
||||
echo "create blob 3\n";
|
||||
$q = ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 2");
|
||||
$row = ibase_fetch_object($q,IBASE_TEXT);
|
||||
|
||||
$bl_h = ibase_blob_create();
|
||||
if ($row->V_BLOB != $blob_str)
|
||||
echo " BLOB 2 fail\n";
|
||||
ibase_free_result($q);
|
||||
unset($blob);
|
||||
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n");
|
||||
ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n");
|
||||
ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n");
|
||||
ibase_blob_add($bl_h, "| any later version. |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n");
|
||||
ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n");
|
||||
ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n");
|
||||
ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n");
|
||||
ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n");
|
||||
ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n");
|
||||
ibase_blob_add($bl_h, "| contact core@php.net. |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
$bl_s = ibase_blob_close($bl_h);
|
||||
ibase_query("insert into test4 (v_integer, v_blob) values (3, ?)", $bl_s);
|
||||
echo "create blob 3\n";
|
||||
|
||||
echo "echo blob 3\n";
|
||||
$bl_h = ibase_blob_create();
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n");
|
||||
ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n");
|
||||
ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n");
|
||||
ibase_blob_add($bl_h, "| any later version. |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n");
|
||||
ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n");
|
||||
ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n");
|
||||
ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n");
|
||||
ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n");
|
||||
ibase_blob_add($bl_h, "| |\n");
|
||||
ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n");
|
||||
ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n");
|
||||
ibase_blob_add($bl_h, "| contact core@php.net. |\n");
|
||||
ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
|
||||
$bl_s = ibase_blob_close($bl_h);
|
||||
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (3, ?)", $bl_s);
|
||||
|
||||
$q = ibase_query("select v_blob from test4 where v_integer = 3");
|
||||
$row = ibase_fetch_object($q);
|
||||
ibase_blob_echo($row->V_BLOB);
|
||||
ibase_free_result($q);
|
||||
|
||||
echo "fetch blob 3\n";
|
||||
$q = ibase_query("select v_blob from test4 where v_integer = 3");
|
||||
$row = ibase_fetch_object($q,IBASE_TEXT);
|
||||
echo $row->V_BLOB;
|
||||
ibase_free_result($q);
|
||||
echo "echo blob 3\n";
|
||||
|
||||
ibase_close();
|
||||
unlink($name);
|
||||
echo "end of test\n";
|
||||
$q = ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 3");
|
||||
$row = ibase_fetch_object($q);
|
||||
ibase_blob_echo($row->V_BLOB);
|
||||
ibase_free_result($q);
|
||||
|
||||
echo "fetch blob 3\n";
|
||||
|
||||
$q = ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 3");
|
||||
$row = ibase_fetch_object($q,IBASE_TEXT);
|
||||
echo $row->V_BLOB;
|
||||
ibase_free_result($q);
|
||||
|
||||
ibase_close();
|
||||
unlink($name);
|
||||
|
||||
echo "end of test\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
import blob 1
|
||||
|
||||
+143
-143
@@ -5,19 +5,19 @@ InterBase: transactions
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
<?php /* $Id$ */
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
ibase_connect($test_base);
|
||||
require("interbase.inc");
|
||||
|
||||
@ibase_query("create table test5 (i integer)");
|
||||
@ibase_query("delete from test5");
|
||||
ibase_close();
|
||||
ibase_connect($test_base);
|
||||
|
||||
@ibase_query("CREATE TABLE test5 (i integer)");
|
||||
@ibase_query("DELETE FROM test5");
|
||||
ibase_close();
|
||||
|
||||
|
||||
echo "default transaction:\n";
|
||||
|
||||
echo "default transaction:\n";
|
||||
|
||||
/*
|
||||
Difference between default and other transactions:
|
||||
default commited when you call ibase_close().
|
||||
@@ -32,35 +32,35 @@ ibase_blob_create(), ibase_blob_import() first time.
|
||||
/*
|
||||
simple default transaction test without ibase_trans()
|
||||
*/
|
||||
|
||||
ibase_connect($test_base);
|
||||
|
||||
echo "empty table\n";
|
||||
ibase_connect($test_base);
|
||||
|
||||
/* out_table call ibase_query()
|
||||
and ibase_query() start default transaction */
|
||||
out_table("test5");
|
||||
echo "empty table\n";
|
||||
|
||||
/* in default transaction context */
|
||||
ibase_query("insert into test5 (i) values (1)");
|
||||
/* out_table call ibase_query()
|
||||
and ibase_query() start default transaction */
|
||||
out_table("test5");
|
||||
|
||||
echo "one row\n";
|
||||
out_table("test5");
|
||||
/* in default transaction context */
|
||||
ibase_query("INSERT INTO test5 (i) VALUES (1)");
|
||||
|
||||
ibase_rollback(); /* default rolled */
|
||||
echo "one row\n";
|
||||
out_table("test5");
|
||||
|
||||
echo "after rollback table empty again\n";
|
||||
out_table("test5"); /* started new default transaction */
|
||||
|
||||
ibase_query("insert into test5 (i) values (2)");
|
||||
ibase_rollback(); /* default rolled */
|
||||
|
||||
ibase_close(); /* commit here! */
|
||||
|
||||
ibase_connect($test_base);
|
||||
|
||||
echo "one row\n";
|
||||
out_table("test5");
|
||||
ibase_close();
|
||||
echo "after rollback table empty again\n";
|
||||
out_table("test5"); /* started new default transaction */
|
||||
|
||||
ibase_query("INSERT INTO test5 (i) VALUES (2)");
|
||||
|
||||
ibase_close(); /* commit here! */
|
||||
|
||||
ibase_connect($test_base);
|
||||
|
||||
echo "one row\n";
|
||||
out_table("test5");
|
||||
ibase_close();
|
||||
|
||||
/*
|
||||
default transaction on default link
|
||||
@@ -68,145 +68,145 @@ First open transaction on link will be default.
|
||||
$tr_def_l1 may be ommited. All queryes without link and trans
|
||||
parameters run in this context
|
||||
*/
|
||||
|
||||
$link_def = ibase_connect($test_base);
|
||||
|
||||
$tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */
|
||||
|
||||
/* all default */
|
||||
$res = ibase_query("select * from test5");
|
||||
|
||||
echo "one row\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
$link_def = ibase_connect($test_base);
|
||||
|
||||
/* specify transaction context... */
|
||||
$res = ibase_query($tr_def_l1, "select * from test5");
|
||||
|
||||
echo "one row... again.\n";
|
||||
out_result($res,"test5");
|
||||
$tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
/* specify default transaction on link */
|
||||
$res = ibase_query($link_def, "select * from test5");
|
||||
|
||||
echo "one row.\n";
|
||||
out_result($res,"test5");
|
||||
/* all default */
|
||||
$res = ibase_query("SELECT * FROM test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
echo "one row\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_rollback($link_def); /* just for example */
|
||||
ibase_free_result($res);
|
||||
|
||||
/* specify transaction context... */
|
||||
$res = ibase_query($tr_def_l1, "SELECT * FROM test5");
|
||||
|
||||
echo "one row... again.\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
/* specify default transaction on link */
|
||||
$res = ibase_query($link_def, "SELECT * FROM test5");
|
||||
|
||||
echo "one row.\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_rollback($link_def); /* just for example */
|
||||
|
||||
ibase_close();
|
||||
|
||||
ibase_close();
|
||||
|
||||
/*
|
||||
three transaction on default link
|
||||
*/
|
||||
ibase_connect($test_base);
|
||||
|
||||
$tr_1 = ibase_trans(); /* this default transaction also */
|
||||
$tr_2 = ibase_trans(IBASE_READ);
|
||||
$tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT);
|
||||
$tr_4 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_NO_VERSION+IBASE_NOWAIT);
|
||||
|
||||
$res = ibase_query("select * from test5");
|
||||
|
||||
echo "one row\n";
|
||||
out_result($res,"test5");
|
||||
ibase_connect($test_base);
|
||||
|
||||
ibase_free_result($res);
|
||||
$tr_1 = ibase_trans(); /* this default transaction also */
|
||||
$tr_2 = ibase_trans(IBASE_READ);
|
||||
$tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT);
|
||||
$tr_4 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_NO_VERSION+IBASE_NOWAIT);
|
||||
|
||||
/* insert in first transaction context... */
|
||||
/* as default */
|
||||
ibase_query("insert into test5 (i) values (3)");
|
||||
/* specify context */
|
||||
ibase_query($tr_1, "insert into test5 (i) values (4)");
|
||||
|
||||
$res = ibase_query("select * from test5");
|
||||
|
||||
echo "three rows\n";
|
||||
out_result($res,"test5");
|
||||
$res = ibase_query("select * from test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
$res = ibase_query($tr_1, "select * from test5");
|
||||
|
||||
echo "three rows again\n";
|
||||
out_result($res,"test5");
|
||||
echo "one row\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_commit($tr_1);
|
||||
ibase_free_result($res);
|
||||
|
||||
$tr_1 = ibase_trans();
|
||||
ibase_query($tr_1, "insert into test5 (i) values (5)");
|
||||
|
||||
/* tr_2 is IBASE_READ + IBASE_CONCURRENCY + IBASE_WAIT */
|
||||
$res = ibase_query($tr_2, "select * from test5");
|
||||
|
||||
echo "one row in second transaction\n";
|
||||
out_result($res,"test5");
|
||||
/* insert in first transaction context... */
|
||||
/* as default */
|
||||
ibase_query("INSERT INTO test5 (i) VALUES (3)");
|
||||
/* specify context */
|
||||
ibase_query($tr_1, "INSERT INTO test5 (i) VALUES (4)");
|
||||
|
||||
ibase_free_result($res);
|
||||
$res = ibase_query("SELECT * FROM test5");
|
||||
|
||||
/* tr_3 is IBASE_COMMITTED + IBASE_REC_VERSION + IBASE_WAIT */
|
||||
$res = ibase_query($tr_3, "select * from test5");
|
||||
|
||||
echo "three rows in third transaction\n";
|
||||
out_result($res,"test5");
|
||||
echo "three rows\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
ibase_free_result($res);
|
||||
|
||||
/* tr_4 IBASE_COMMITED + IBASE_REC_NO_VERSION + IBASE_NOWAIT */
|
||||
$res = ibase_query($tr_4, "select * from test5");
|
||||
|
||||
echo "three rows in fourth transaction with deadlock\n";
|
||||
out_result_trap_error($res,"test5");
|
||||
$res = ibase_query($tr_1, "SELECT * FROM test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_rollback($tr_1);
|
||||
ibase_close();
|
||||
echo "three rows again\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_commit($tr_1);
|
||||
|
||||
$tr_1 = ibase_trans();
|
||||
ibase_query($tr_1, "INSERT INTO test5 (i) VALUES (5)");
|
||||
|
||||
/* tr_2 is IBASE_READ + IBASE_CONCURRENCY + IBASE_WAIT */
|
||||
$res = ibase_query($tr_2, "SELECT * FROM test5");
|
||||
|
||||
echo "one row in second transaction\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
/* tr_3 is IBASE_COMMITTED + IBASE_REC_VERSION + IBASE_WAIT */
|
||||
$res = ibase_query($tr_3, "SELECT * FROM test5");
|
||||
|
||||
echo "three rows in third transaction\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
/* tr_4 IBASE_COMMITED + IBASE_REC_NO_VERSION + IBASE_NOWAIT */
|
||||
$res = ibase_query($tr_4, "SELECT * FROM test5");
|
||||
|
||||
echo "three rows in fourth transaction with deadlock\n";
|
||||
out_result_trap_error($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_rollback($tr_1);
|
||||
ibase_close();
|
||||
/*
|
||||
transactions on second link
|
||||
*/
|
||||
$link_1 = ibase_pconnect($test_base);
|
||||
$link_2 = ibase_pconnect($test_base);
|
||||
|
||||
$tr_1 = ibase_trans(IBASE_DEFAULT, $link_2); /* this default transaction also */
|
||||
$tr_2 = ibase_trans(IBASE_COMMITTED, $link_2);
|
||||
|
||||
$res = ibase_query($tr_1, "select * from test5");
|
||||
|
||||
echo "three rows\n";
|
||||
out_result($res,"test5");
|
||||
$link_1 = ibase_pconnect($test_base);
|
||||
$link_2 = ibase_pconnect($test_base);
|
||||
|
||||
ibase_free_result($res);
|
||||
$tr_1 = ibase_trans(IBASE_DEFAULT, $link_2); /* this default transaction also */
|
||||
$tr_2 = ibase_trans(IBASE_COMMITTED, $link_2);
|
||||
|
||||
ibase_query($tr_1, "insert into test5 (i) values (5)");
|
||||
|
||||
$res = ibase_query($tr_1, "select * from test5");
|
||||
|
||||
echo "four rows\n";
|
||||
out_result($res,"test5");
|
||||
$res = ibase_query($tr_1, "SELECT * FROM test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_commit($tr_1);
|
||||
|
||||
$res = ibase_query($tr_2, "select * from test5");
|
||||
|
||||
echo "four rows again\n";
|
||||
out_result($res,"test5");
|
||||
echo "three rows\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_close($link_1);
|
||||
ibase_close($link_2);
|
||||
ibase_free_result($res);
|
||||
|
||||
echo "end of test\n";
|
||||
ibase_query($tr_1, "INSERT INTO test5 (i) VALUES (5)");
|
||||
|
||||
$res = ibase_query($tr_1, "SELECT * FROM test5");
|
||||
|
||||
echo "four rows\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_commit($tr_1);
|
||||
|
||||
$res = ibase_query($tr_2, "SELECT * FROM test5");
|
||||
|
||||
echo "four rows again\n";
|
||||
out_result($res,"test5");
|
||||
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_close($link_1);
|
||||
ibase_close($link_2);
|
||||
|
||||
echo "end of test\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
default transaction:
|
||||
|
||||
+165
-169
@@ -5,200 +5,196 @@ InterBase: binding (may take a while)
|
||||
--POST--
|
||||
--GET--
|
||||
--FILE--
|
||||
<?php
|
||||
<?php /* $Id$ */
|
||||
|
||||
require("interbase.inc");
|
||||
|
||||
ibase_connect($test_base);
|
||||
|
||||
ibase_query(
|
||||
"create table test6 (
|
||||
iter integer,
|
||||
v_char char(1000),
|
||||
v_date timestamp,
|
||||
v_decimal decimal(12,3),
|
||||
v_double double precision,
|
||||
v_float float,
|
||||
v_integer integer,
|
||||
v_numeric numeric(4,2),
|
||||
v_smallint smallint,
|
||||
v_varchar varchar(10000)
|
||||
)");
|
||||
ibase_commit();
|
||||
require("interbase.inc");
|
||||
|
||||
/* if timefmt not supported, hide error */
|
||||
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
|
||||
ibase_connect($test_base);
|
||||
|
||||
echo "insert\n";
|
||||
ibase_query(
|
||||
"CREATE TABLE test6 (
|
||||
iter integer,
|
||||
v_char char(1000),
|
||||
v_date timestamp,
|
||||
v_decimal decimal(12,3),
|
||||
v_double double precision,
|
||||
v_float float,
|
||||
v_integer integer,
|
||||
v_numeric numeric(4,2),
|
||||
v_smallint smallint,
|
||||
v_varchar varchar(10000)
|
||||
)");
|
||||
ibase_commit();
|
||||
|
||||
for($iter = 0; $iter < 3; $iter++){
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal = rand_number(12,3);
|
||||
$v_double = rand_number(20);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_numeric = rand_number(4,2);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
/* if timefmt not supported, hide error */
|
||||
@ibase_timefmt("%m/%d/%Y %H:%M:%S");
|
||||
|
||||
ibase_query("insert into test6
|
||||
(iter,v_char,v_date,v_decimal,v_double,v_float,
|
||||
v_integer,v_numeric,v_smallint,v_varchar)
|
||||
values (?,?,?,?,?,?,?,?,?,?)",
|
||||
$iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
|
||||
$v_integer, $v_numeric, $v_smallint, $v_varchar);
|
||||
$sel = ibase_query("select * from test6 where iter = $iter");
|
||||
echo "insert\n";
|
||||
|
||||
$row = ibase_fetch_object($sel);
|
||||
if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
|
||||
echo " CHAR fail:\n";
|
||||
echo " in: $v_char\n";
|
||||
echo " out: $row->V_CHAR\n";
|
||||
}
|
||||
if($row->V_DATE != $v_date){
|
||||
echo " DATE fail\n";
|
||||
echo " in: $v_date\n";
|
||||
echo " out: $row->V_DATE\n";
|
||||
}
|
||||
if($row->V_DECIMAL != $v_decimal){
|
||||
echo " DECIMAL fail\n";
|
||||
echo " in: $v_decimal\n";
|
||||
echo " out: $row->V_DECIMAL\n";
|
||||
}
|
||||
if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
|
||||
echo " DOUBLE fail\n";
|
||||
echo " in: $v_double\n";
|
||||
echo " out: $row->V_DOUBLE\n";
|
||||
}
|
||||
if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
|
||||
echo " FLOAT fail\n";
|
||||
echo " in: $v_float\n";
|
||||
echo " out: $row->V_FLOAT\n";
|
||||
}
|
||||
if($row->V_INTEGER != $v_integer){
|
||||
echo " INTEGER fail\n";
|
||||
echo " in: $v_integer\n";
|
||||
echo " out: $row->V_INTEGER\n";
|
||||
}
|
||||
if ($row->V_NUMERIC != $v_numeric){
|
||||
echo " NUMERIC fail\n";
|
||||
echo " in: $v_numeric\n";
|
||||
echo " out: $row->V_NUMERIC\n";
|
||||
}
|
||||
if ($row->V_SMALLINT != $v_smallint){
|
||||
echo " SMALLINT fail\n";
|
||||
echo " in: $v_smallint\n";
|
||||
echo " out: $row->V_SMALLINT\n";
|
||||
}
|
||||
if ($row->V_VARCHAR != $v_varchar){
|
||||
echo " VARCHAR fail:\n";
|
||||
echo " in: $v_varchar\n";
|
||||
echo " out: $row->V_VARCHAR\n";
|
||||
}
|
||||
ibase_free_result($sel);
|
||||
}/* for($iter)*/
|
||||
for ($iter = 0; $iter < 3; ++$iter) {
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal = rand_number(12,3);
|
||||
$v_double = rand_number(20);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_numeric = rand_number(4,2);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
|
||||
echo "select\n";
|
||||
for($iter = 0; $iter < 3; $iter++){
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal = rand_number(12,3);
|
||||
$v_double = rand_number(20);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_numeric = rand_number(4,2);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
ibase_query("INSERT INTO test6
|
||||
(iter,v_char,v_date,v_decimal,v_double,v_float, v_integer,
|
||||
v_numeric,v_smallint,v_varchar) VALUES (?,?,?,?,?,?,?,?,?,?)",
|
||||
$iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
|
||||
$v_integer, $v_numeric, $v_smallint, $v_varchar);
|
||||
$sel = ibase_query("SELECT * FROM test6 WHERE iter = $iter");
|
||||
|
||||
/* clear table*/
|
||||
ibase_query("delete from test6");
|
||||
$row = ibase_fetch_object($sel);
|
||||
if (substr($row->V_CHAR,0,strlen($v_char)) != $v_char) {
|
||||
echo " CHAR fail:\n";
|
||||
echo " in: $v_char\n";
|
||||
echo " out: $row->V_CHAR\n";
|
||||
}
|
||||
if ($row->V_DATE != $v_date) {
|
||||
echo " DATE fail\n";
|
||||
echo " in: $v_date\n";
|
||||
echo " out: $row->V_DATE\n";
|
||||
}
|
||||
if ($row->V_DECIMAL != $v_decimal) {
|
||||
echo " DECIMAL fail\n";
|
||||
echo " in: $v_decimal\n";
|
||||
echo " out: $row->V_DECIMAL\n";
|
||||
}
|
||||
if (abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)) {
|
||||
echo " DOUBLE fail\n";
|
||||
echo " in: $v_double\n";
|
||||
echo " out: $row->V_DOUBLE\n";
|
||||
}
|
||||
if (abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)) {
|
||||
echo " FLOAT fail\n";
|
||||
echo " in: $v_float\n";
|
||||
echo " out: $row->V_FLOAT\n";
|
||||
}
|
||||
if ($row->V_INTEGER != $v_integer) {
|
||||
echo " INTEGER fail\n";
|
||||
echo " in: $v_integer\n";
|
||||
echo " out: $row->V_INTEGER\n";
|
||||
}
|
||||
if ($row->V_NUMERIC != $v_numeric) {
|
||||
echo " NUMERIC fail\n";
|
||||
echo " in: $v_numeric\n";
|
||||
echo " out: $row->V_NUMERIC\n";
|
||||
}
|
||||
if ($row->V_SMALLINT != $v_smallint) {
|
||||
echo " SMALLINT fail\n";
|
||||
echo " in: $v_smallint\n";
|
||||
echo " out: $row->V_SMALLINT\n";
|
||||
}
|
||||
if ($row->V_VARCHAR != $v_varchar) {
|
||||
echo " VARCHAR fail:\n";
|
||||
echo " in: $v_varchar\n";
|
||||
echo " out: $row->V_VARCHAR\n";
|
||||
}
|
||||
ibase_free_result($sel);
|
||||
} /* for($iter) */
|
||||
|
||||
/* make one record */
|
||||
ibase_query("insert into test6
|
||||
(iter, v_char,v_date,v_decimal,
|
||||
v_integer,v_numeric,v_smallint,v_varchar)
|
||||
values (666, '$v_char','$v_date',$v_decimal, $v_integer,
|
||||
$v_numeric, $v_smallint, '$v_varchar')");
|
||||
echo "select\n";
|
||||
for ($iter = 0; $iter < 3; ++$iter) {
|
||||
/* prepare data */
|
||||
$v_char = rand_str(1000);
|
||||
$v_date = rand_datetime();
|
||||
$v_decimal = rand_number(12,3);
|
||||
$v_double = rand_number(20);
|
||||
$v_float = rand_number(7);
|
||||
$v_integer = rand_number(9,0);
|
||||
$v_numeric = rand_number(4,2);
|
||||
$v_smallint = rand_number(5) % 32767;
|
||||
$v_varchar = rand_str(10000);
|
||||
|
||||
/* test all types */
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_char = ?", $v_char)))
|
||||
echo "CHAR fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_date = ?", $v_date)))
|
||||
echo "DATE fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_decimal = ?", $v_decimal)))
|
||||
echo "DECIMAL fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_integer = ?", $v_integer)))
|
||||
echo "INTEGER fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_numeric = ?", $v_numeric)))
|
||||
echo "NUMERIC fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_smallint = ?", $v_smallint)))
|
||||
echo "SMALLINT fail\n";
|
||||
ibase_free_result($sel);
|
||||
if(!($sel = ibase_query(
|
||||
"select iter from test6 where v_varchar = ?", $v_varchar)))
|
||||
echo "VARCHAR fail\n";
|
||||
ibase_free_result($sel);
|
||||
|
||||
}/*for iter*/
|
||||
/* clear table*/
|
||||
ibase_query("DELETE FROM test6");
|
||||
|
||||
echo "prepare and exec insert\n";
|
||||
/* make one record */
|
||||
ibase_query("INSERT INTO test6 (iter, v_char,v_date,v_decimal,v_integer,v_numeric,
|
||||
v_smallint,v_varchar) VALUES (666, '$v_char','$v_date',$v_decimal, $v_integer,
|
||||
$v_numeric, $v_smallint, '$v_varchar')");
|
||||
|
||||
/* prepare table */
|
||||
ibase_query("delete from test6");
|
||||
/* test all types */
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_char = ?", $v_char)))
|
||||
echo "CHAR fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_date = ?", $v_date)))
|
||||
echo "DATE fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_decimal = ?", $v_decimal)))
|
||||
echo "DECIMAL fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_integer = ?", $v_integer)))
|
||||
echo "INTEGER fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_numeric = ?", $v_numeric)))
|
||||
echo "NUMERIC fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_smallint = ?", $v_smallint)))
|
||||
echo "SMALLINT fail\n";
|
||||
ibase_free_result($sel);
|
||||
if (!($sel = ibase_query(
|
||||
"SELECT iter FROM test6 WHERE v_varchar = ?", $v_varchar)))
|
||||
echo "VARCHAR fail\n";
|
||||
ibase_free_result($sel);
|
||||
|
||||
} /* for ($iter) */
|
||||
|
||||
/* prepare query */
|
||||
$query = ibase_prepare(
|
||||
"insert into test6 (v_integer) values (?)");
|
||||
echo "prepare and exec insert\n";
|
||||
|
||||
for($i = 0; $i < 10; $i++)
|
||||
ibase_execute($query, $i);
|
||||
/* prepare table */
|
||||
ibase_query("DELETE FROM test6");
|
||||
|
||||
out_table("test6");
|
||||
/* prepare query */
|
||||
$query = ibase_prepare(
|
||||
"INSERT INTO test6 (v_integer) VALUES (?)");
|
||||
|
||||
ibase_free_query($query);
|
||||
for($i = 0; $i < 10; $i++)
|
||||
ibase_execute($query, $i);
|
||||
|
||||
out_table("test6");
|
||||
|
||||
ibase_free_query($query);
|
||||
|
||||
|
||||
echo "prepare and exec select\n";
|
||||
echo "prepare and exec select\n";
|
||||
|
||||
/* prepare query */
|
||||
$query = ibase_prepare("select * from test6
|
||||
where v_integer between ? and ?");
|
||||
/* prepare query */
|
||||
$query = ibase_prepare("SELECT * FROM test6 WHERE v_integer BETWEEN ? AND ?");
|
||||
|
||||
$low_border = 2;
|
||||
$high_border = 6;
|
||||
$low_border = 2;
|
||||
$high_border = 6;
|
||||
|
||||
$res = ibase_execute($query, $low_border, $high_border);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
$res = ibase_execute($query, $low_border, $high_border);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
|
||||
$low_border = 0;
|
||||
$high_border = 4;
|
||||
$res = ibase_execute($query, $low_border, $high_border);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
$low_border = 0;
|
||||
$high_border = 4;
|
||||
$res = ibase_execute($query, $low_border, $high_border);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
|
||||
$res = ibase_execute($query, "5", 7.5);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
$res = ibase_execute($query, "5", 7.5);
|
||||
out_result($res, "test6");
|
||||
ibase_free_result($res);
|
||||
|
||||
ibase_free_query($query);
|
||||
ibase_free_query($query);
|
||||
|
||||
ibase_close();
|
||||
echo "end of test\n";
|
||||
ibase_close();
|
||||
echo "end of test\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
insert
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -67,7 +67,7 @@ static const char *mbfl_encoding_html_ent_aliases[] = {"HTML", "html", NULL};
|
||||
const mbfl_encoding mbfl_encoding_html_ent = {
|
||||
mbfl_no_encoding_html_ent,
|
||||
"HTML-ENTITIES",
|
||||
"US-ASCII",
|
||||
"HTML-ENTITIES",
|
||||
(const char *(*)[])&mbfl_encoding_html_ent_aliases,
|
||||
NULL, /* mblen_table_html, Do not use table instead calulate length based on entities actually used */
|
||||
MBFL_ENCTYPE_HTML_ENT
|
||||
|
||||
@@ -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);
|
||||
|
||||
+33
-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
|
||||
@@ -53,16 +56,41 @@ yes
|
||||
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
|
||||
+379
-181
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 */
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
@@ -1394,6 +1394,48 @@ DLEXPORT PHP_FUNCTION(udm_add_search_limit)
|
||||
stl_info.t1=(time_t)(atol(val+1));
|
||||
UdmAddTimeLimit(Agent->Conf,&stl_info);
|
||||
}
|
||||
#elif UDM_VERSION_ID >= 30210
|
||||
{
|
||||
struct tm *d_tm;
|
||||
time_t d_t;
|
||||
char *d_val2;
|
||||
char d_db[20], d_de[20];
|
||||
d_t = atol (val+1);
|
||||
d_tm = localtime (&d_t);
|
||||
if (val[0] == '>') {
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","er");
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dx","1");
|
||||
sprintf (d_db, "%d", d_tm->tm_mday);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dd",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_mon);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dm",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dy",d_db);
|
||||
RETURN_TRUE;
|
||||
} else if (val[0] == '<') {
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","er");
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dx","-1");
|
||||
sprintf (d_db, "%d", d_tm->tm_mday);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dd",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_mon);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dm",d_db);
|
||||
sprintf (d_db, "%d", d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dy",d_db);
|
||||
RETURN_TRUE;
|
||||
} else if ( (val[0]=='#') && (d_val2 = strchr(val,',')) ){
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"dt","range");
|
||||
sprintf (d_db, "%d/%d/%d", d_tm->tm_mday, d_tm->tm_mon+1, d_tm->tm_year+1900);
|
||||
d_t = atol (d_val2+1);
|
||||
d_tm = localtime (&d_t);
|
||||
sprintf (d_de, "%d/%d/%d", d_tm->tm_mday, d_tm->tm_mon+1, d_tm->tm_year+1900);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"db",d_db);
|
||||
UdmVarListReplaceStr(&Agent->Conf->Vars,"de",d_de);
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Incorrect date limit format");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
@@ -2200,9 +2242,9 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
|
||||
{
|
||||
int len,i;
|
||||
for(len = i = 0; i < Res->WWList.nwords; i++)
|
||||
len += Res->WWList.Word[i].len;
|
||||
len += Res->WWList.Word[i].len + 64;
|
||||
{
|
||||
size_t wsize=(1+len*15)*sizeof(char);
|
||||
size_t wsize=(1+len)*sizeof(char);
|
||||
char *wordinfo = (char*) malloc(wsize);
|
||||
|
||||
*wordinfo = '\0';
|
||||
@@ -2230,9 +2272,9 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param)
|
||||
{
|
||||
int len,i,j;
|
||||
for(len = i = 0; i < Res->WWList.nwords; i++)
|
||||
len += Res->WWList.Word[i].len;
|
||||
len += Res->WWList.Word[i].len + 64;
|
||||
{
|
||||
size_t wsize=(1+len*15)*sizeof(char);
|
||||
size_t wsize=(1+len)*sizeof(char);
|
||||
char *wordinfo = (char*) malloc(wsize);
|
||||
int corder = (size_t)-1, ccount = 0;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
+55
-11
@@ -336,7 +336,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 +344,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;
|
||||
@@ -800,6 +801,15 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
|
||||
Z_DVAL_P(result) = (double) floatcol4(offset);
|
||||
Z_TYPE_P(result) = IS_DOUBLE;
|
||||
break;
|
||||
case SQLMONEY:
|
||||
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;
|
||||
@@ -838,8 +848,21 @@ 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);
|
||||
@@ -898,8 +921,21 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
|
||||
|
||||
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);
|
||||
@@ -956,6 +992,9 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme
|
||||
case SQLFLT4:
|
||||
case SQLFLT8:
|
||||
case SQLFLTN:
|
||||
case SQLMONEY4:
|
||||
case SQLMONEY:
|
||||
case SQLMONEYN:
|
||||
convert_to_double_ex(&bind->zval);
|
||||
Z_DVAL_P(bind->zval) = *((double *)(dbretdata(mssql_ptr->link,i)));
|
||||
break;
|
||||
@@ -996,6 +1035,7 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
|
||||
column_types = (int *) emalloc(sizeof(int) * result->num_fields);
|
||||
for (i=0; i<result->num_fields; i++) {
|
||||
char *source = NULL;
|
||||
char *fname = (char *)dbcolname(mssql_ptr->link,i+1);
|
||||
|
||||
if (*fname) {
|
||||
@@ -1010,8 +1050,11 @@ static int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int r
|
||||
j++;
|
||||
}
|
||||
result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
|
||||
result->fields[i].column_source = estrdup(dbcolsource(mssql_ptr->link,i+1));
|
||||
if (!result->fields[i].column_source) {
|
||||
source = (char *)dbcolsource(mssql_ptr->link,i+1);
|
||||
if (source) {
|
||||
result->fields[i].column_source = estrdup(source);
|
||||
}
|
||||
else {
|
||||
result->fields[i].column_source = empty_string;
|
||||
}
|
||||
|
||||
@@ -1063,7 +1106,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;
|
||||
@@ -1793,6 +1836,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 {
|
||||
@@ -2103,8 +2149,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 */
|
||||
@@ -2127,7 +2171,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+7
-3
@@ -2982,7 +2982,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;
|
||||
@@ -3118,11 +3118,11 @@ PHP_FUNCTION(ocisavelob)
|
||||
|
||||
if (offparam == -1) {
|
||||
offset = curloblen;
|
||||
} else if (offparam >= curloblen) {
|
||||
} else if ((ub4)offparam >= curloblen) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is bigger than current LOB-Size - appending");
|
||||
offset = curloblen;
|
||||
} else {
|
||||
offset = offparam;
|
||||
offset = (ub4)offparam;
|
||||
}
|
||||
} else if (zend_get_parameters_ex(1, &arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -3136,6 +3136,10 @@ PHP_FUNCTION(ocisavelob)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (offset <= 0) {
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
CALL_OCI_RETURN(connection->error, OCILobWrite(
|
||||
connection->pServiceContext,
|
||||
connection->pError,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+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 */
|
||||
|
||||
+2
-3
@@ -1952,7 +1952,7 @@ PHP_FUNCTION(pdf_open_image_file)
|
||||
PHP_FUNCTION(pdf_open_memory_image)
|
||||
{
|
||||
zval **arg1, **arg2;
|
||||
int i, j, color, count;
|
||||
int i, j, color;
|
||||
int pdf_image;
|
||||
gdImagePtr im;
|
||||
unsigned char *buffer, *ptr;
|
||||
@@ -1970,8 +1970,7 @@ PHP_FUNCTION(pdf_open_memory_image)
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd);
|
||||
|
||||
count = 3 * im->sx * im->sy;
|
||||
buffer = (unsigned char *) emalloc(count);
|
||||
buffer = (unsigned char *) safe_emalloc(3 * im->sx, im->sy, 0);
|
||||
|
||||
ptr = buffer;
|
||||
for(i=0; i<im->sy; i++) {
|
||||
|
||||
+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);
|
||||
|
||||
+56
-9
@@ -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);
|
||||
}
|
||||
@@ -3853,16 +3853,63 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
|
||||
ZVAL_STRING(new_val, "NULL", 1);
|
||||
}
|
||||
else {
|
||||
/* FIXME: better regex must be used */
|
||||
if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^[+-]{0,1}[ \\t]+((second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago){0,1}$", 1 TSRMLS_CC) == FAILURE &&
|
||||
php_pgsql_convert_match(Z_STRVAL_PP(val), "^@[ \\t]+[+-]{0,1}[ \\t]+(second|seconds|minute|minute|hour|hour|day|days|week|weeks|month|monthes|year|years|decade|decades|century|centuries|millennium|millenniums){1,1}[ \\t]+)+([ \\t]+ago$", 1 TSRMLS_CC) == FAILURE) {
|
||||
|
||||
/* From the Postgres docs:
|
||||
|
||||
interval values can be written with the following syntax:
|
||||
[@] quantity unit [quantity unit...] [direction]
|
||||
|
||||
Where: quantity is a number (possibly signed); unit is second, minute, hour,
|
||||
day, week, month, year, decade, century, millennium, or abbreviations or
|
||||
plurals of these units [note not *all* abbreviations] ; direction can be
|
||||
ago or empty. The at sign (@) is optional noise.
|
||||
|
||||
...
|
||||
|
||||
Quantities of days, hours, minutes, and seconds can be specified without explicit
|
||||
unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10
|
||||
sec'.
|
||||
*/
|
||||
if (php_pgsql_convert_match(Z_STRVAL_PP(val),
|
||||
"^(@?[ \\t]+)?("
|
||||
|
||||
/* Textual time units and their abbreviations: */
|
||||
"(([-+]?[ \\t]+)?"
|
||||
"[0-9]+(\\.[0-9]*)?[ \\t]*"
|
||||
"(millenniums|millennia|millennium|mil|mils|"
|
||||
"centuries|century|cent|c|"
|
||||
"decades|decade|dec|decs|"
|
||||
"years|year|y|"
|
||||
"months|month|mon|"
|
||||
"weeks|week|w|"
|
||||
"days|day|d|"
|
||||
"hours|hour|hr|hrs|h|"
|
||||
"minutes|minute|mins|min|m|"
|
||||
"seconds|second|secs|sec|s))+|"
|
||||
|
||||
/* Textual time units plus (dd)* hh[:mm[:ss]] */
|
||||
"((([-+]?[ \\t]+)?"
|
||||
"[0-9]+(\\.[0-9]*)?[ \\t]*"
|
||||
"(millenniums|millennia|millennium|mil|mils|"
|
||||
"centuries|century|cent|c|"
|
||||
"decades|decade|dec|decs|"
|
||||
"years|year|y|"
|
||||
"months|month|mon|"
|
||||
"weeks|week|w|"
|
||||
"days|day|d))+"
|
||||
"([-+]?[ \\t]+"
|
||||
"([0-9]+[ \\t]+)+" /* dd */
|
||||
"(([0-9]{1,2}:){0,2}[0-9]{0,2})" /* hh:[mm:[ss]] */
|
||||
")?))"
|
||||
"([ \\t]+ago)?$",
|
||||
1 TSRMLS_CC) == FAILURE) {
|
||||
err = 1;
|
||||
}
|
||||
else {
|
||||
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
|
||||
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IS_NULL:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -224,7 +224,7 @@ PHPAPI void php_session_start(TSRMLS_D);
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(ps)
|
||||
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps)
|
||||
|
||||
void php_session_auto_start(void *data);
|
||||
void php_session_shutdown(void *data);
|
||||
|
||||
+48
-26
@@ -79,7 +79,7 @@ function_entry session_functions[] = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(ps);
|
||||
PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps);
|
||||
|
||||
static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
|
||||
static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -596,7 +608,7 @@ static void php_session_initialize(TSRMLS_D)
|
||||
|
||||
/* Open session handler first */
|
||||
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage module.");
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -863,7 +875,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 +938,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. */
|
||||
@@ -1106,8 +1119,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 +1183,28 @@ 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);
|
||||
RETVAL_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
|
||||
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 {
|
||||
RETURN_STRING(safe_estrdup(PS(mod)->s_name), 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1283,6 +1292,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 +1360,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));
|
||||
}
|
||||
@@ -1369,7 +1379,7 @@ PHP_FUNCTION(session_register)
|
||||
if (argc <= 0)
|
||||
RETURN_FALSE
|
||||
else
|
||||
args = (zval ***)emalloc(argc * sizeof(zval **));
|
||||
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
|
||||
|
||||
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
|
||||
efree(args);
|
||||
@@ -1612,14 +1622,26 @@ PHP_RSHUTDOWN_FUNCTION(session)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_minit_session_globals(php_ps_globals *ps_globals)
|
||||
{
|
||||
ps_globals->save_path = NULL;
|
||||
ps_globals->session_name = NULL;
|
||||
ps_globals->id = NULL;
|
||||
ps_globals->mod = NULL;
|
||||
ps_globals->mod_data = NULL;
|
||||
ps_globals->session_status = php_session_none;
|
||||
ps_globals->http_session_vars = NULL;
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(session)
|
||||
{
|
||||
#ifdef ZTS
|
||||
php_ps_globals *ps_globals;
|
||||
|
||||
ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), NULL, NULL);
|
||||
ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), (ts_allocate_ctor) php_minit_session_globals, NULL);
|
||||
ps_globals = ts_resource(ps_globals_id);
|
||||
#else
|
||||
php_minit_session_globals(&ps_globals);
|
||||
#endif
|
||||
|
||||
zend_register_auto_global("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
|
||||
|
||||
Loaded 100 of 273 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user