mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-12 03:30:50 +00:00
Compare commits
519
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e743518e7 | ||
|
|
2650819396 | ||
|
|
82e38322ed | ||
|
|
9dd09fa253 | ||
|
|
78bafb0a0f | ||
|
|
11e98efaeb | ||
|
|
4572d1ca93 | ||
|
|
2e3affd121 | ||
|
|
c64fd50c99 | ||
|
|
d0341050db | ||
|
|
8b5ef28849 | ||
|
|
ce5840bfdd | ||
|
|
a98e4ef9e8 | ||
|
|
68babbb4cd | ||
|
|
7547d0cfbd | ||
|
|
8e9f4c457e | ||
|
|
4e196361d8 | ||
|
|
de2f172277 | ||
|
|
06c10055d5 | ||
|
|
42b7576ae8 | ||
|
|
79fcfd26f3 | ||
|
|
4f07d5a965 | ||
|
|
426f625c99 | ||
|
|
9a0f85e1fa | ||
|
|
ba508184f0 | ||
|
|
0833aba80f | ||
|
|
2d820b6dee | ||
|
|
215ed32e25 | ||
|
|
03c4f24419 | ||
|
|
5743a33991 | ||
|
|
9183f91b50 | ||
|
|
78ba9bf7d7 | ||
|
|
b50858afb3 | ||
|
|
f865b20700 | ||
|
|
13fa7f7256 | ||
|
|
3f49790ce6 | ||
|
|
f463d67389 | ||
|
|
d530f46597 | ||
|
|
ac6c88a4dc | ||
|
|
42d4af122b | ||
|
|
c85bb04fa5 | ||
|
|
46079e009c | ||
|
|
03913f1308 | ||
|
|
c82f578f82 | ||
|
|
9555ebfabb | ||
|
|
8d626495ed | ||
|
|
5e2f93d2dd | ||
|
|
767c3476f0 | ||
|
|
4ef8f95450 | ||
|
|
bf6759dd01 | ||
|
|
af53d53b11 | ||
|
|
d6463e5a3f | ||
|
|
ae194a9a9c | ||
|
|
9859b1f397 | ||
|
|
fddecc1352 | ||
|
|
0d845f2ea4 | ||
|
|
0ddcc317e5 | ||
|
|
80fdc3ac5e | ||
|
|
3b80c7560c | ||
|
|
751bd7f024 | ||
|
|
43fa58a0c1 | ||
|
|
5106b38ae5 | ||
|
|
9e20484a18 | ||
|
|
82ddbebbe4 | ||
|
|
3704f085ed | ||
|
|
8688512c84 | ||
|
|
2fb797e325 | ||
|
|
522bdfb820 | ||
|
|
c7ef927a4b | ||
|
|
63394e6885 | ||
|
|
41ce678468 | ||
|
|
05b895cd39 | ||
|
|
75841af9f6 | ||
|
|
55518f5360 | ||
|
|
740b23ecdf | ||
|
|
b17ba8c110 | ||
|
|
3c2689b7a7 | ||
|
|
2556bb635c | ||
|
|
800e57ea5c | ||
|
|
ddac7fe373 | ||
|
|
6d7ea1ac5e | ||
|
|
042862140c | ||
|
|
1724f8e6a8 | ||
|
|
fcfc10f3ff | ||
|
|
ff870e6149 | ||
|
|
e0cfa4d51b | ||
|
|
6dba27dc90 | ||
|
|
da68b9b16f | ||
|
|
02dee4ae0f | ||
|
|
342e04ca80 | ||
|
|
8fe2b1bed4 | ||
|
|
f5da540a4a | ||
|
|
c741a9e719 | ||
|
|
06a2e4ce94 | ||
|
|
923ec1c813 | ||
|
|
b8257c86e2 | ||
|
|
701d735b4a | ||
|
|
efa98f98a7 | ||
|
|
c65348f1ef | ||
|
|
b64e13a8d8 | ||
|
|
ac33ea9aa3 | ||
|
|
76f175e312 | ||
|
|
8b882a5b3f | ||
|
|
0a99718803 | ||
|
|
ba4a956864 | ||
|
|
3190028b5b | ||
|
|
2e128a6e09 | ||
|
|
bcc763bfb9 | ||
|
|
cd9eaf74b2 | ||
|
|
150a72925b | ||
|
|
37d7c2b316 | ||
|
|
6e06124ea7 | ||
|
|
5cc99a6ac0 | ||
|
|
a67935f091 | ||
|
|
47536e7ac1 | ||
|
|
093a132957 | ||
|
|
1b5f44e88c | ||
|
|
d8ea4f11d1 | ||
|
|
0ad3be52c6 | ||
|
|
2a328b9ba7 | ||
|
|
96c20f31ba | ||
|
|
f81d41c762 | ||
|
|
3059580aed | ||
|
|
2183cfb649 | ||
|
|
25cf53b352 | ||
|
|
eafc0420f0 | ||
|
|
7423659c35 | ||
|
|
a8a5e7573c | ||
|
|
146e3220b7 | ||
|
|
348694d57c | ||
|
|
078c700804 | ||
|
|
6cb09f8e0b | ||
|
|
6086495713 | ||
|
|
b330229b84 | ||
|
|
c7200842cc | ||
|
|
bb1332fe02 | ||
|
|
1ed47a60c6 | ||
|
|
97ec1ff4de | ||
|
|
1bf24dcad9 | ||
|
|
e414432792 | ||
|
|
3a2fb03556 | ||
|
|
a029c98992 | ||
|
|
7094c2e6cf | ||
|
|
f275a211cd | ||
|
|
71f96764db | ||
|
|
104346f695 | ||
|
|
867e81ddcf | ||
|
|
e4782e05ca | ||
|
|
b53261c1f7 | ||
|
|
d2b516a17e | ||
|
|
5343858182 | ||
|
|
90b5168603 | ||
|
|
0cdfe8042a | ||
|
|
b5e1063103 | ||
|
|
21bdd33fff | ||
|
|
b857a3579f | ||
|
|
d861d47034 | ||
|
|
d1b80a614a | ||
|
|
0857ef4e0e | ||
|
|
52ea2ff77a | ||
|
|
758e9b813f | ||
|
|
0d1eea3e50 | ||
|
|
68d3a2a4a3 | ||
|
|
4e0748c5cf | ||
|
|
6ba14f7c60 | ||
|
|
cee2f89bac | ||
|
|
af2640314c | ||
|
|
5a731ab4a8 | ||
|
|
3de754c066 | ||
|
|
276f733eff | ||
|
|
c2982d7dd0 | ||
|
|
caa994f64a | ||
|
|
386958ed03 | ||
|
|
12d269131a | ||
|
|
d6091a30e2 | ||
|
|
9ba95c7002 | ||
|
|
4e13631ec1 | ||
|
|
ef4e1a153e | ||
|
|
7577029efd | ||
|
|
328a1117f1 | ||
|
|
748de20686 | ||
|
|
40f8b98419 | ||
|
|
1bdfef5b38 | ||
|
|
af2cbccc89 | ||
|
|
a958154f5c | ||
|
|
3c6eac005e | ||
|
|
2010493086 | ||
|
|
17953a4c1d | ||
|
|
33218a673f | ||
|
|
931158fde1 | ||
|
|
5eb5dfa536 | ||
|
|
5e37deccc1 | ||
|
|
d09cdd9f71 | ||
|
|
eab21631e8 | ||
|
|
79d65efb1d | ||
|
|
cff8050b83 | ||
|
|
8622b50012 | ||
|
|
4413882286 | ||
|
|
bfc4de7e6f | ||
|
|
55e2692100 | ||
|
|
2518165f92 | ||
|
|
79b610def8 | ||
|
|
d544099dcb | ||
|
|
3ae330cd00 | ||
|
|
bfbbf5cedc | ||
|
|
7de57d1a0f | ||
|
|
221d961e02 | ||
|
|
a7d4af0f34 | ||
|
|
df96b038aa | ||
|
|
5db859f053 | ||
|
|
a235714d20 | ||
|
|
c8add6a3c2 | ||
|
|
6deefd1444 | ||
|
|
a6f21df54c | ||
|
|
baef306ffe | ||
|
|
d8eb4055f0 | ||
|
|
2d4b98bf8b | ||
|
|
3df7ed81db | ||
|
|
38d7c22ee0 | ||
|
|
21d984c1bb | ||
|
|
f5f6a1bb02 | ||
|
|
52cd8053dc | ||
|
|
3452a4d9cb | ||
|
|
a40c67d2fa | ||
|
|
f94cbfb33d | ||
|
|
3ba3e35a3e | ||
|
|
695d12d0db | ||
|
|
85a1e14e37 | ||
|
|
40d52ebc39 | ||
|
|
b4ff2c495f | ||
|
|
18ccd896c7 | ||
|
|
710d2fef1c | ||
|
|
695b15b209 | ||
|
|
fc325ce662 | ||
|
|
62a06d2d9e | ||
|
|
719b107576 | ||
|
|
381734bede | ||
|
|
7a9d1fb1d5 | ||
|
|
eca56e4b59 | ||
|
|
05affa4c86 | ||
|
|
7b23a065e8 | ||
|
|
ce6b662ed6 | ||
|
|
08fdbaecf8 | ||
|
|
9285368cc1 | ||
|
|
ed160b9a19 | ||
|
|
2063ff5a15 | ||
|
|
b1c2b7a493 | ||
|
|
4939dff84e | ||
|
|
1d019347cd | ||
|
|
8ce349b8e0 | ||
|
|
f3797e0015 | ||
|
|
c60e945965 | ||
|
|
19859a1b35 | ||
|
|
82be7f8f85 | ||
|
|
db4678d6af | ||
|
|
a86cdc6952 | ||
|
|
d7d5069d8b | ||
|
|
5a27a76b1b | ||
|
|
00448a5211 | ||
|
|
2640b806d6 | ||
|
|
1930be2528 | ||
|
|
6b1cc632d1 | ||
|
|
2843a96a82 | ||
|
|
f4a9417486 | ||
|
|
254adf10bd | ||
|
|
770b04e09e | ||
|
|
f0893ba362 | ||
|
|
b3a89ba1ba | ||
|
|
9f24154bed | ||
|
|
d81b8bcb7b | ||
|
|
2399cb1321 | ||
|
|
16a1587e08 | ||
|
|
3b4f3489f9 | ||
|
|
4a3be1d920 | ||
|
|
ac378c3b78 | ||
|
|
c51ccc9243 | ||
|
|
3526bcf9cf | ||
|
|
531f14ca6e | ||
|
|
d98646435e | ||
|
|
ebec35f646 | ||
|
|
119e74d6c2 | ||
|
|
5e63dccbb9 | ||
|
|
bfdac383dc | ||
|
|
f4feaeeff9 | ||
|
|
2e0caa5f5f | ||
|
|
00b89e2d34 | ||
|
|
bdbc54c1ab | ||
|
|
8fa2dc1c64 | ||
|
|
feac7f8dbb | ||
|
|
496a8fbfbd | ||
|
|
bb671b8928 | ||
|
|
4a3aae2b74 | ||
|
|
8e5c9a3d35 | ||
|
|
00e1c513c3 | ||
|
|
d16cfb98e1 | ||
|
|
cc65afef4d | ||
|
|
9d36b04b69 | ||
|
|
b8a50ab35b | ||
|
|
2cfff608bd | ||
|
|
7d1ea234ff | ||
|
|
cdf0dde4e4 | ||
|
|
53db4b6087 | ||
|
|
146a948d37 | ||
|
|
a778e8ae49 | ||
|
|
28bcbea342 | ||
|
|
1887ae79d6 | ||
|
|
85afcb802d | ||
|
|
d9918485df | ||
|
|
2f8f30a9d1 | ||
|
|
3a121f0377 | ||
|
|
8709e2b651 | ||
|
|
233a99a4e5 | ||
|
|
32c7c2f458 | ||
|
|
9f562a55a4 | ||
|
|
909033e650 | ||
|
|
2284d365f9 | ||
|
|
591103e629 | ||
|
|
b5e3c39343 | ||
|
|
e7c2bb9077 | ||
|
|
9ae244bca8 | ||
|
|
5493a5af6b | ||
|
|
353f3d693d | ||
|
|
c941788794 | ||
|
|
db46216831 | ||
|
|
5906410a83 | ||
|
|
e3049fe418 | ||
|
|
f37d8ad76a | ||
|
|
ffa626068b | ||
|
|
16b517057e | ||
|
|
0cd04dd8ee | ||
|
|
6477d350b2 | ||
|
|
5b90adb4f7 | ||
|
|
74a7342ac1 | ||
|
|
0d93c5366d | ||
|
|
d067b201cf | ||
|
|
89511b316a | ||
|
|
fbe44d0345 | ||
|
|
8e3bf69780 | ||
|
|
24150c7b1d | ||
|
|
3ccba5514f | ||
|
|
8f95eb97e2 | ||
|
|
39a1bc4a46 | ||
|
|
7f3804f4ae | ||
|
|
659c0d344a | ||
|
|
3bd4199865 | ||
|
|
6d72c22eea | ||
|
|
2a1d0e96c0 | ||
|
|
573c568e85 | ||
|
|
311d262169 | ||
|
|
d4f91d59dd | ||
|
|
feb4c90222 | ||
|
|
5c966aaa06 | ||
|
|
972c932097 | ||
|
|
1950289d3d | ||
|
|
8369e2bfab | ||
|
|
9a53c1577f | ||
|
|
c1b700d871 | ||
|
|
015f87f5a9 | ||
|
|
94e8a7b47d | ||
|
|
39fec23c4c | ||
|
|
79864e31c1 | ||
|
|
8aa7f7e3f9 | ||
|
|
0a0d20f919 | ||
|
|
11f5296b41 | ||
|
|
239a85c33e | ||
|
|
fda8417776 | ||
|
|
05febcfc9a | ||
|
|
9c71c7530b | ||
|
|
926ec43123 | ||
|
|
a6306386c3 | ||
|
|
37e937db25 | ||
|
|
ea6ac022d6 | ||
|
|
99365dfd46 | ||
|
|
1ad623b515 | ||
|
|
d795792f8f | ||
|
|
5bad102755 | ||
|
|
e465c076f5 | ||
|
|
cfb4c916b8 | ||
|
|
eb51b4f23a | ||
|
|
dedcaff2f2 | ||
|
|
896fe268fb | ||
|
|
352d90baac | ||
|
|
8595c6b6b8 | ||
|
|
6644e5c5ec | ||
|
|
519642125f | ||
|
|
1a94c0f341 | ||
|
|
aa6ecd5619 | ||
|
|
fce70d11e6 | ||
|
|
7576762fb6 | ||
|
|
cadd10f56b | ||
|
|
8ba63bf7c0 | ||
|
|
3656d13b68 | ||
|
|
d225b1ce81 | ||
|
|
fae7e2bff2 | ||
|
|
b0f4a8e912 | ||
|
|
584fb97aed | ||
|
|
abe7b677f3 | ||
|
|
4dceadd4c1 | ||
|
|
40d04782e0 | ||
|
|
5135548c9d | ||
|
|
eb393b600c | ||
|
|
81afaf32d7 | ||
|
|
63a9f23f74 | ||
|
|
86e161007c | ||
|
|
5fa11c0579 | ||
|
|
332f700522 | ||
|
|
6d58950fe6 | ||
|
|
40108e7c04 | ||
|
|
46d47e77d0 | ||
|
|
fae392c88f | ||
|
|
485321056a | ||
|
|
4924aa83f3 | ||
|
|
ff8c742822 | ||
|
|
525e7171a4 | ||
|
|
4dac7613a2 | ||
|
|
b601848ecd | ||
|
|
207248483e | ||
|
|
1a635c7c89 | ||
|
|
4baee906ce | ||
|
|
8594a3806f | ||
|
|
aad8b12fea | ||
|
|
a2ad16ef21 | ||
|
|
08c6d398cc | ||
|
|
b01b5d8e58 | ||
|
|
2d36d2dd9f | ||
|
|
fd1fc2de89 | ||
|
|
fd13faea13 | ||
|
|
28a638fe7b | ||
|
|
7b6535c100 | ||
|
|
047f1e936f | ||
|
|
d738786436 | ||
|
|
9f0a5dc5e0 | ||
|
|
bba259101f | ||
|
|
d67b99c290 | ||
|
|
e61a96db00 | ||
|
|
51a414ac42 | ||
|
|
00330f2ae7 | ||
|
|
1aa8063f2f | ||
|
|
0205c37cf8 | ||
|
|
17157f8092 | ||
|
|
f157b9f12a | ||
|
|
46e5e2d0c2 | ||
|
|
3a32a2f48a | ||
|
|
4f043328df | ||
|
|
20e400b6c0 | ||
|
|
f809403a2d | ||
|
|
f52a914791 | ||
|
|
5450a0dcd1 | ||
|
|
e50067c6ce | ||
|
|
8516c7deb1 | ||
|
|
fe7ea4ca83 | ||
|
|
0de3906316 | ||
|
|
a8541e0178 | ||
|
|
0a650df8da | ||
|
|
ade2667c70 | ||
|
|
ce6102342f | ||
|
|
b09e421111 | ||
|
|
28e45cf6e4 | ||
|
|
4a23aa4535 | ||
|
|
4b9cca7c0c | ||
|
|
155eff97df | ||
|
|
39e0e30af0 | ||
|
|
5efebee28a | ||
|
|
55b18c598d | ||
|
|
d52c8ab857 | ||
|
|
8037889e2c | ||
|
|
26b9ee7df1 | ||
|
|
b4734f0dc6 | ||
|
|
18335130cc | ||
|
|
e649f719bd | ||
|
|
8fc219f0e3 | ||
|
|
a16a9a753e | ||
|
|
5050078bc0 | ||
|
|
1832daf3cc | ||
|
|
3efb2acb34 | ||
|
|
d9d53a1d69 | ||
|
|
c7a9ce70e8 | ||
|
|
327c876dc6 | ||
|
|
5329f7ce4c | ||
|
|
a4f8a9214c | ||
|
|
09a5954e67 | ||
|
|
e0fef8b821 | ||
|
|
4e9005d847 | ||
|
|
1c82847edd | ||
|
|
ab8e8c6380 | ||
|
|
1bb1e8f5fa | ||
|
|
69ba9df048 | ||
|
|
ff757583ff | ||
|
|
cbf631cf84 | ||
|
|
eaed8e0922 | ||
|
|
84c1e20749 | ||
|
|
6a8e47ca98 | ||
|
|
dfaf49e9fd | ||
|
|
e65f524f92 | ||
|
|
69f10386f4 | ||
|
|
ee70304a32 | ||
|
|
137eb633aa | ||
|
|
fe99a3a8a1 | ||
|
|
62eceedcc4 | ||
|
|
e1f15df15c | ||
|
|
6696ac41c5 | ||
|
|
b1efdfae47 | ||
|
|
d7842bb07c | ||
|
|
bac150263b | ||
|
|
eb6732ad60 | ||
|
|
4c11305640 | ||
|
|
43b641eab9 | ||
|
|
8325a296cb | ||
|
|
0d7b574472 | ||
|
|
2fa9bcdc29 | ||
|
|
27054e3850 | ||
|
|
07081e2699 | ||
|
|
67745d4f44 | ||
|
|
8013c023cb | ||
|
|
3d75c3fa8b | ||
|
|
912cb5d161 | ||
|
|
56bad109e2 | ||
|
|
e421488f99 | ||
|
|
21545018c3 |
No files matched your search
+1
-1
@@ -69,7 +69,7 @@ clean:
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp5.module buildmk.stamp
|
||||
egrep define'.*include/php' configure|sed 's/.*>//'|xargs rm -f
|
||||
egrep define'.*include/php' $(top_srcdir)/configure|sed 's/.*>//'|xargs rm -f
|
||||
find . -name Makefile | xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
|
||||
@@ -1,5 +1,225 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
25 Aug 2005, PHP 5.0.5RC2
|
||||
- Upgraded PCRE library to version 5.0. (Andrei)
|
||||
- Removed php_check_syntax() function which never worked properly. (Ilia)
|
||||
- Added new function mysqli_set_charset(). (Georg)
|
||||
- Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana)
|
||||
- Added support for .cc files in extensions. (Brian)
|
||||
- Added PHP_INT_MAX and PHP_INT_SIZE as predefined constants. (Andrey)
|
||||
- Changed sha1_file() and md5_file() functions to use streams instead of
|
||||
low level IO. (Uwe)
|
||||
- Changed ming to support official 0.2a and 0.3 library versions. (Marcus)
|
||||
- Fixed failing queries problem (FALSE returned) with mysqli_query() on 64 bit.
|
||||
(Andrey)
|
||||
- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
|
||||
passed. (Derick)
|
||||
- Fixed ext/mysqli to allocate less memory when fetching bound params
|
||||
of type (MEDIUM|LONG)BLOB/(MEDIUM|LONG)TEXT. (Andrey)
|
||||
- Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey)
|
||||
- Fixed memory corruption in stristr(). (Derick)
|
||||
- Fixed segfaults when CURL callback functions throw exception. (Tony)
|
||||
- Fixed various reentrancy bugs in user-sort functions, solves bugs #33286 and
|
||||
#33295. (Mike Bretz)
|
||||
- Fixed bug #34078 (Reflection API problems in methods with boolean or
|
||||
null default values). (Tony)
|
||||
- Fixed bug #34064 (arr[] as param to function is allowed only if function
|
||||
receives argument by reference). (Dmitry)
|
||||
- Fixed bug #34062 (Crash in catch block when many arguments are used).
|
||||
(Dmitry)
|
||||
- Fixed bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP). (Dmitry)
|
||||
- Fixed bug #33940 (array_map() fails to pass by reference when called
|
||||
recursively). (Dmitry)
|
||||
- Fixed bug #33853 (php:function call __autoload with lowercase param). (Marcus)
|
||||
- Fixed bug #33802 (throw Exception in error handler causes crash). (Dmitry)
|
||||
- Fixed bug #33723 (php_value overrides php_admin_value). (Dmitry)
|
||||
- Fixed bug #33710 (ArrayAccess objects doen't initialize $this). (Dmitry)
|
||||
- Fixed bug #33588 (LDAP: RootDSE query not possible). (Jani)
|
||||
- Fixed bug #33558 (warning with nested calls to functions returning by
|
||||
reference). (Dmitry)
|
||||
- Fixed bug #33520 (crash if safe_mode is on and session.save_path is changed).
|
||||
(Dmitry)
|
||||
- Fixed bug #33491 (crash after extending MySQLi internal class). (Tony)
|
||||
- Fixed bug #33340 (CLI Crash when calling php:function from XSLT). (Rob)
|
||||
- Fixed bug #33277 (private method accessed by child class). (Dmitry)
|
||||
- Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in
|
||||
length). (Ilia)
|
||||
- Fixed bug #33263 (mysqli_real_escape doesn't work in __construct) (Georg)
|
||||
- Fixed bug #33257 (array_splice() inconsistent when passed function instead
|
||||
of variable). (Dmitry)
|
||||
- Fixed bug #33243 (ze1_compatibility_mode does not work as expected). (Dmitry)
|
||||
- Fixed bug #33242 (Mangled error message when stream fails). (Derick)
|
||||
- Fixed bug #33222 (segfault when CURL handle is closed in a callback). (Tony)
|
||||
- Fixed bug #33214 (odbc_next_result does not signal SQL errors with
|
||||
2-statement SQL batches). (rich at kastle dot com, Tony)
|
||||
- Fixed bug #33210 (relax jpeg recursive loop protection). (Ilia)
|
||||
- Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' modifier
|
||||
misbehave). (Jani)
|
||||
- Fixed bug #33185 (--enable-session=shared does not build). (Jani)
|
||||
- Fixed bug #33171 (foreach enumerates private fields declared in base
|
||||
classes). (Dmitry)
|
||||
- Fixed bug #33164 (Soap extension incorrectly detects HTTP/1.1). (Ilia)
|
||||
- Fixed bug #33156 (cygwin version of setitimer doesn't accept ITIMER_PROF).
|
||||
(Nuno)
|
||||
- Fixed bug #33116 (crash when assigning class name to global variable in
|
||||
__autoload). (Dmitry)
|
||||
- Fixed bug #33090 (mysqli_prepare() doesn't return an error). (Georg)
|
||||
- Fixed bug #33076 (str_ireplace() incorrectly counts result string length
|
||||
and may cause segfault). (Tony)
|
||||
- Fixed bug #33072 (Add a safemode/open_basedir check for runtime
|
||||
"session.save_path" change using session_save_path() function). (Rasmus)
|
||||
- Fixed bug #33070 (Improved performance of bzdecompress() by several orders
|
||||
of magnitude). (Ilia)
|
||||
- Fixed bug #33059 (crash when moving xml attribute set in dtd). (Ilia)
|
||||
- Fixed bug #33057 (Don't send extraneous entity-headers on a 304 as per
|
||||
RFC 2616 section 10.3.5) (Rasmus, Choitel)
|
||||
- Fixed bug #33019 (socket errors cause memory leaks in php_strerror()).
|
||||
(jwozniak23 at poczta dot onet dot pl, Tony).
|
||||
- Fixed bug #33017 ("make distclean" gives an error with VPATH build). (Jani)
|
||||
- Fixed bug #33013 ("next month" was handled wrong while parsing dates).
|
||||
(Derick)
|
||||
- Fixed bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.54
|
||||
seg fault). (Dmitry)
|
||||
- Fixed bug #32956 (mysql_bind_result() doesn't support MYSQL_TYPE_NULL). (Georg)
|
||||
- Fixed bug #32947 (Incorrect option for mysqli default password). (Georg)
|
||||
- Fixed bug #32944 (Disabling session.use_cookies doesn't prevent reading
|
||||
session cookies). (Jani, Tony)
|
||||
- Fixed bug #32941 (Sending structured SOAP fault kills a php). (Dmitry)
|
||||
- Fixed bug #32936 (http redirects URLs are not checked for control chars). (Ilia)
|
||||
- Fixed bug #32933 (Cannot extend class "SQLiteDatabase"). (Marcus)
|
||||
- Fixed bug #32932 (Oracle LDAP: ldap_get_entries(), invalid pointer). (Jani)
|
||||
- Fixed bug #32930 (class extending DOMDocument doesn't clone properly). (Rob)
|
||||
- Fixed bug #32904 (pg_get_notify() ignores result_type parameter). (Tony)
|
||||
- Fixed bug #32852 (Crash with singleton and __destruct when
|
||||
zend.ze1_compatibility_mode = On). (Dmitry)
|
||||
- Fixed bug #32813 (parse_url() does not handle scheme-only urls properly). (Ilia)
|
||||
- Fixed bug #32810 (temporary files not using plain file wrapper). (Ilia)
|
||||
- Fixed bug #32809 (Missing T1LIB support on Windows). (Edin)
|
||||
- Fixed bug #32802 (General cookie overrides more specific cookie). (Ilia)
|
||||
- Fixed bugs #32800, #32830 (ext/odbc: Problems with 64bit systems). (Jani)
|
||||
- Fixed bug #32799 (crash: calling the corresponding global var during the
|
||||
destruct). (Dmitry)
|
||||
- Fixed bug #32776 (SOAP doesn't support one-way operations). (Dmitry)
|
||||
- Fixed bug #32773 (GMP functions break when second parameter is 0). (Stas)
|
||||
- Fixed bug #32759 (incorrect determination of default value (COM)). (Wez)
|
||||
- Fixed bug #32758 (Cannot access safearray properties in VB6 objects). (Wez)
|
||||
- Fixed bug #32755 (Segfault in replaceChild() when DocumentFragment has
|
||||
no children). (Rob)
|
||||
- Fixed bug #32753 (Undefined constant SQLITE_NOTADB). (Ilia)
|
||||
- Fixed bug #32742 (segmentation fault when the stream with a wrapper
|
||||
is not closed). (Tony, Dmitry)
|
||||
- Fixed bug #32699 (pg_affected_rows() was defined when it was not available).
|
||||
(Derick)
|
||||
- Fixed bug #32686 (Require/include file in destructor causes segfault).
|
||||
(Marcus)
|
||||
- Fixed bug #32682 (ext/mssql: Error on module shutdown when called from
|
||||
activescript). (Frank)
|
||||
- Fixed bug #32674 (exception in iterator causes crash). (Dmitry)
|
||||
- Fixed bug #32660 (Assignment by reference causes crash when field access is
|
||||
overloaded (__get)). (Dmitry)
|
||||
- Fixed bug #32647 (Using register_shutdown_function() with invalid callback
|
||||
can crash PHP). (Jani)
|
||||
- Fixed bug #32615 (Segfault in replaceChild() using fragment when
|
||||
previousSibling is NULL). (Rob)
|
||||
- Fixed bug #32613 (ext/snmp: use of snmp_shutdown() causes snmpapp.conf
|
||||
access errors). (Jani, ric at arizona dot edu)
|
||||
- Fixed bug #32608 (html_entity_decode() converts single quotes even if
|
||||
ENT_NOQUOTES is given). (Ilia)
|
||||
- Fixed bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct).
|
||||
(Dmitry)
|
||||
- Fixed bug #32591 (ext/mysql: Unsatisfied symbol: ntohs with HP-UX). (Jani)
|
||||
- Fixed bug #32589 (Possible crash inside imap_mail_compose, with charsets).
|
||||
(Ilia)
|
||||
- Fixed bug #32587 (Apache2: errors sent to error_log do not include
|
||||
timestamps). (Jani)
|
||||
- Fixed bug #32560 (configure looks for incorrect db2 library). (Tony)
|
||||
- Fixed bug #32553 (mmap loads only the 1st 2000000 bytes on Win32). (Ilia)
|
||||
- Fixed bug #32533 (proc_get_status() returns the incorrect process status). (Ilia)
|
||||
- Fixed bug #32530 (chunk_split() does not append endstr if chunklen is
|
||||
longer then the original string). (Ilia)
|
||||
- Fixed bug #32491 (File upload error - unable to create a temporary file).
|
||||
(Uwe Schindler)
|
||||
- Fixed bug #32405 (mysqli::fetch() returns bad data - 64bit problem). (Andrey)
|
||||
- Fixed bug #32282 (Segfault in mysqli_fetch_array on 64-bit). (Georg)
|
||||
- Fixed bug #32296 (get_class_methods() output has changed between 5.0.2 and
|
||||
5.0.3). (Dmitry)
|
||||
- Fixed bug #32245 (xml_parser_free() in a function assigned to the xml parser
|
||||
gives a segfault). (Rob)
|
||||
- Fixed bug #32171 (Userspace stream wrapper crashes PHP). (Tony, Dmitry)
|
||||
- Fixed bug #32080 (segfault when assigning object to itself with
|
||||
zend.ze1_compatibility_mode=On). (Dmitry)
|
||||
- Fixed bug #32013 (ext/mysqli bind_result causes fatal error: memory
|
||||
limit). (Andrey)
|
||||
- Fixed bug #31887 (ISAPI: Custom 5xx error does not return correct HTTP
|
||||
response message). (Jani)
|
||||
- Fixed bug #31828 (Crash with zend.ze1_compatibility_mode=On). (Dmitry)
|
||||
- Fixed bug #31668 (multi_query works exactly every other time - multi query
|
||||
d/e flag global and not per connection). (Andrey)
|
||||
- Fixed bug #31636 (another crash when echoing a COM object). (Wez)
|
||||
- Fixed bug #31583 (php_std_date() uses short day names in non-y2k_compliance
|
||||
mode). (mike at php dot net)
|
||||
- Fixed bug #31525 (object reference being dropped. $this getting lost).
|
||||
(Stas, Dmitry)
|
||||
- Fixed bug #31502 (Wrong deserialization from session when using WDDX
|
||||
serializer). (Dmitry)
|
||||
- Fixed bug #31465 (False warning in unpack() when working with *). (Ilia)
|
||||
- Fixed bug #31363 (broken non-blocking flock()). ian at snork dot net
|
||||
- Fixed bug #31213 (Sideeffects caused by fix of bug #29493). (Dmitry)
|
||||
- Fixed bug #31158 (array_splice on $GLOBALS crashes). (Dmitry)
|
||||
- Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine()).
|
||||
(Dmitry)
|
||||
- Fixed bug #30889 (Conflict between __get/__set and ++ operator). (Dmitry)
|
||||
- Fixed bug #30833 (array_count_values() modifying input array). (Tony)
|
||||
- Fixed bug #30828 (debug_backtrace() reports incorrect class in overridden
|
||||
methods). (Dmitry)
|
||||
- Fixed bug #30820 (static member conflict with $this->member silently
|
||||
ignored). (Dmitry)
|
||||
- Fixed bug #30819 (Better support for LDAP SASL bind). (Jani)
|
||||
- Fixed bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call if
|
||||
object is overloaded). (Dmitry)
|
||||
- Fixed bug #30707 (Segmentation fault on exception in method). (Stas, Dmitry)
|
||||
- Fixed bug #30702 (cannot initialize class variable from class constant).
|
||||
(Dmitry)
|
||||
- Fixed bug #30519 (Interface not existing says Class not found). (Dmitry)
|
||||
- Fixed bug #30394 (Assignment operators yield wrong result with __get/__set).
|
||||
(Dmitry)
|
||||
- Fixed bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with
|
||||
array_push()). (Dmitry)
|
||||
- Fixed bug #30162 (Catching exception in constructor causes lose of $this).
|
||||
(Dmitry)
|
||||
- Fixed bug #30140 (Problem with array in static properties). (Dmitry)
|
||||
- Fixed bug #30126 (Enhancement for error message for abstract classes).
|
||||
(Marcus)
|
||||
- Fixed bug #30080 (Passing array or non array of objects). (Dmitry)
|
||||
- Fixed bug #29975 (memory leaks when set_error_handler() is used inside error
|
||||
handler). (Tony)
|
||||
- Fixed bug #29971 (variables_order behaviour). (Dmitry)
|
||||
- Fixed bug #29944 (Function defined in switch, crashes). (Dmitry)
|
||||
- Fixed bug #29896 (Backtrace argument list out of sync). (Dmitry)
|
||||
- Fixed bug #29683 (headers_list() returns empty array). (Tony)
|
||||
- Fixed bug #29583 (crash when echoing a COM object). (M.Sisolak, Wez)
|
||||
- Fixed bug #29338 (unencoded spaces get ignored after certain tags). (Ilia)
|
||||
- Fixed bug #29210 (Function: is_callable - no support for private and
|
||||
protected classes). (Dmitry)
|
||||
- Fixed bug #29104 (Function declaration in method doesn't work). (Dmitry)
|
||||
- Fixed bug #29015 (Incorrect behavior of member vars(non string ones)-numeric
|
||||
mem vars und others). (Dmitry)
|
||||
- Fixed bug #28839 (SIGSEGV in interactive mode (php -a)).
|
||||
(kameshj at fastmail dot fm)
|
||||
- Fixed bug #28605 (Need to use -[m]ieee option for Alpha CPUs). (Jani)
|
||||
- Fixed bug #28377 (debug_backtrace is intermittently passing args). (Dmitry)
|
||||
- Fixed bug #27598 (list() array key assignment causes HUGE memory leak).
|
||||
(Dmitry)
|
||||
- Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when
|
||||
called via STDIN). (Dmitry)
|
||||
- Fixed bug #25922 (In error handler, modifying 5th arg (errcontext) may result
|
||||
in seg fault). (Dmitry)
|
||||
- Fixed bug #22836 (returning reference to uninitialized variable). (Dmitry)
|
||||
- Fixed bug #29689 (default value of protected member overrides default value of private)
|
||||
and other private variable problems in inherited classes (Stas)
|
||||
- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
|
||||
- Abstract private methods are no longer allowed (Stas)
|
||||
|
||||
31 Mar 2005, PHP 5.0.4
|
||||
- Added SNMPv2 support. (harrie)
|
||||
- Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
|
||||
@@ -13,6 +233,7 @@ PHP NEWS
|
||||
to 3.7.0. (Moriyoshi)
|
||||
- Updated bundled libmbfl library (used for multibyte functions). (Moriyoshi)
|
||||
Fixed bugs:
|
||||
. Bug #32311 (mb_encode_mimeheader() does not properly escape characters)
|
||||
. Bug #32063 (mb_convert_encoding ignores named entity 'alpha')
|
||||
. Bug #31911 (mb_decode_mimeheader() is case-sensitive to hex escapes)
|
||||
. bug #30573 (compiler warnings in libmbfl due to invalid type cast)
|
||||
@@ -52,7 +273,6 @@ PHP NEWS
|
||||
- Fixed bug #32001 (xml_parse_into_struct() function exceeds maximum
|
||||
execution time). (Rob, Moriyoshi)
|
||||
- Fixed bug #31980 (Unicode exif data not available on Windows). (Edin)
|
||||
- Fixed bug #31792 (getrusage() does not provide ru_nswap value). (Ilia)
|
||||
- Fixed bug #31960 (msql_fetch_row() and msql_fetch_array() dropping columns
|
||||
with NULL values). (Daniel Convissor)
|
||||
- Fixed bug #31878 (Segmentation fault using clone keyword on nodes). (Rob)
|
||||
@@ -64,6 +284,7 @@ PHP NEWS
|
||||
- Fixed bug #31797 (exif_read_data() uses too low nesting limit). (Ilia)
|
||||
- Fixed bug #31796 (readline completion handler does not handle empty return
|
||||
values). (Ilia)
|
||||
- Fixed bug #31792 (getrusage() does not provide ru_nswap value). (Ilia)
|
||||
- Fixed bug #31755 (Cannot create SOAP header in no namespace). (Dmitry)
|
||||
- Fixed bug #31754 (dbase_open() fails for mode = 1). (Mehdi, Derick)
|
||||
- Fixed bug #31751 (pg_parameter_status() missing on Windows). (Edin)
|
||||
@@ -92,7 +313,6 @@ PHP NEWS
|
||||
translation). (Ilia)
|
||||
- Fixed bug #31480 (Possible infinite loop in imap_mail_compose()). (Ilia)
|
||||
- Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). (Ilia)
|
||||
- Fixed bug #31465 (False warning in unpack() when working with *). (Ilia)
|
||||
- Fixed bug #31454 (session_set_save_handler crashes PHP when supplied
|
||||
non-existent object ref). (Tony)
|
||||
- Fixed bug #31444 (Memory leak in zend_language_scanner.c).
|
||||
|
||||
-18
@@ -535,12 +535,6 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
|
||||
#ifdef TSRM_WIN32
|
||||
DeleteCriticalSection(mutexp);
|
||||
free(mutexp);
|
||||
#elif defined(NETWARE)
|
||||
#ifdef USE_MPK
|
||||
kMutexFree(mutexp);
|
||||
#else
|
||||
NXMutexFree(mutexp);
|
||||
#endif
|
||||
#elif defined(GNUPTH)
|
||||
free(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
@@ -570,12 +564,6 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
|
||||
#ifdef TSRM_WIN32
|
||||
EnterCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(NETWARE)
|
||||
#ifdef USE_MPK
|
||||
return kMutexLock(mutexp);
|
||||
#else
|
||||
return NXLock(mutexp);
|
||||
#endif
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_acquire(mutexp, 0, NULL);
|
||||
#elif defined(PTHREADS)
|
||||
@@ -601,12 +589,6 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
|
||||
#ifdef TSRM_WIN32
|
||||
LeaveCriticalSection(mutexp);
|
||||
return 1;
|
||||
#elif defined(NETWARE)
|
||||
#ifdef USE_MPK
|
||||
return kMutexUnlock(mutexp);
|
||||
#else
|
||||
return NXUnlock(mutexp);
|
||||
#endif
|
||||
#elif defined(GNUPTH)
|
||||
return pth_mutex_release(mutexp);
|
||||
#elif defined(PTHREADS)
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ int main() {
|
||||
], [
|
||||
dnl For cross compiling running this test is of no use. NetWare supports pthreads
|
||||
pthreads_working=no
|
||||
case $target_alias in
|
||||
case $host_alias in
|
||||
*netware*)
|
||||
pthreads_working=yes
|
||||
esac
|
||||
|
||||
+27
-32
@@ -42,8 +42,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
/*#include "pipe.h"*/
|
||||
#include "tsrm_nw.h"
|
||||
#include <fsio.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_REALPATH
|
||||
@@ -142,15 +141,9 @@ static int php_check_dots(const char *element, int n)
|
||||
|
||||
static int php_is_dir_ok(const cwd_state *state)
|
||||
{
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
|
||||
#else
|
||||
struct stat_libc buf;
|
||||
|
||||
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode))
|
||||
#endif
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
@@ -158,15 +151,9 @@ static int php_is_dir_ok(const cwd_state *state)
|
||||
|
||||
static int php_is_file_ok(const cwd_state *state)
|
||||
{
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
struct stat buf;
|
||||
|
||||
if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
|
||||
#else
|
||||
struct stat_libc buf;
|
||||
|
||||
if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode))
|
||||
#endif
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
@@ -202,7 +189,20 @@ CWD_API void virtual_cwd_startup(void)
|
||||
char cwd[MAXPATHLEN];
|
||||
char *result;
|
||||
|
||||
#ifdef NETWARE
|
||||
result = getcwdpath(cwd, NULL, 1);
|
||||
if(result)
|
||||
{
|
||||
char *c=cwd;
|
||||
while(c = strchr(c, '\\'))
|
||||
{
|
||||
*c='/';
|
||||
++c;
|
||||
}
|
||||
}
|
||||
#else
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
#endif
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
}
|
||||
@@ -445,8 +445,19 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#elif defined(NETWARE)
|
||||
/* If the token is a volume name, it will have colon at the end -- so, no slash before it */
|
||||
if (ptr[ptr_length-1] != ':') {
|
||||
/*
|
||||
Below code keeps appending to state->cwd a File system seperator
|
||||
cases where this appending should not happen is given below,
|
||||
a) sys: should just be left as it is
|
||||
b) sys:system should just be left as it is,
|
||||
Colon is allowed only in the first token as volume names alone can have the : in their names.
|
||||
Files and Directories cannot have : in their names
|
||||
So the check goes like this,
|
||||
For second token and above simply append the DEFAULT_SLASH to the state->cwd.
|
||||
For first token check for the existence of :
|
||||
if it exists don't append the DEFAULT_SLASH to the state->cwd.
|
||||
*/
|
||||
if(((state->cwd_length == 0) && (strchr(ptr, ':') == NULL)) || (state->cwd_length > 0)) {
|
||||
state->cwd[state->cwd_length++] = DEFAULT_SLASH;
|
||||
}
|
||||
#else
|
||||
@@ -716,7 +727,6 @@ CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
@@ -730,21 +740,6 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
#else
|
||||
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC)
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
virtual_file_ex(&new_state, path, NULL, 1);
|
||||
|
||||
retval = stat(new_state.cwd, (struct stat*)buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef TSRM_WIN32
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)
|
||||
|
||||
@@ -74,10 +74,8 @@ typedef unsigned short mode_t;
|
||||
#define DEFAULT_DIR_SEPARATOR ';'
|
||||
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
|
||||
#define IS_SLASH_P(c) IS_SLASH(*(c))
|
||||
#define COPY_WHEN_ABSOLUTE(path) \
|
||||
(strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(strchr(path, ':') != NULL) /* Colon indicates volume name */
|
||||
((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\'))))
|
||||
|
||||
#else
|
||||
#ifdef HAVE_DIRENT_H
|
||||
@@ -141,11 +139,7 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
|
||||
CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH))
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#else
|
||||
CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC);
|
||||
#endif
|
||||
#if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
@@ -136,6 +136,15 @@ AC_ARG_ENABLE(debug,
|
||||
|
||||
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
|
||||
|
||||
AC_ARG_ENABLE(zend-memory-manager,
|
||||
[ --disable-zend-memory-manager
|
||||
Disable the Zend memory manager - FOR DEVELOPERS ONLY!!],
|
||||
[
|
||||
ZEND_USE_ZEND_ALLOC=$enableval
|
||||
], [
|
||||
ZEND_USE_ZEND_ALLOC=yes
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(maintainer-zts,
|
||||
[ --enable-maintainer-zts Enable thread safety - for code maintainers only],[
|
||||
ZEND_MAINTAINER_ZTS=$enableval
|
||||
@@ -165,6 +174,9 @@ AC_ARG_ENABLE(zend-multibyte,
|
||||
ZEND_MULTIBYTE=no
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(whether to enable the Zend memory manager)
|
||||
AC_MSG_RESULT($ZEND_USE_ZEND_ALLOC)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable thread-safety)
|
||||
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
|
||||
|
||||
@@ -195,6 +207,12 @@ fi
|
||||
|
||||
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
||||
|
||||
if test "$ZEND_USE_ZEND_ALLOC" = "yes"; then
|
||||
AC_DEFINE(USE_ZEND_ALLOC,1,[Use Zend memory manager])
|
||||
else
|
||||
AC_DEFINE(USE_ZEND_ALLOC,0,[Use Zend memory manager])
|
||||
fi
|
||||
|
||||
if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
|
||||
AC_DEFINE(ZTS,1,[ ])
|
||||
CFLAGS="$CFLAGS -DZTS"
|
||||
|
||||
@@ -98,6 +98,13 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
|
||||
|
||||
#ifdef NETWARE
|
||||
#ifdef USE_WINSOCK
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T
|
||||
#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
@@ -39,5 +39,5 @@ echo "Done\n";
|
||||
2
|
||||
3
|
||||
Done
|
||||
test::destructor
|
||||
test::__destruct
|
||||
test::destructor
|
||||
@@ -64,11 +64,3 @@ string(3) "foo"
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
string(3) "foo"
|
||||
'foo'
|
||||
|
||||
Notice: Undefined variable: a in %s on line %d
|
||||
|
||||
Strict Standards: Only variable references should be returned by reference in %s on line %d
|
||||
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #27268 (Bad references accentuated by clone)
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
public function &getA()
|
||||
{
|
||||
return $this->a;
|
||||
}
|
||||
}
|
||||
|
||||
$A = new A;
|
||||
$A->a = array(1);
|
||||
$x = $A->getA();
|
||||
$clone = clone $A;
|
||||
$clone->a = array();
|
||||
print_r($A);
|
||||
?>
|
||||
--EXPECT--
|
||||
A Object
|
||||
(
|
||||
[a] => Array
|
||||
(
|
||||
[0] => 1
|
||||
)
|
||||
|
||||
)
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #27304
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Staticexample
|
||||
{
|
||||
static function test()
|
||||
{
|
||||
var_dump(isset($this));
|
||||
}
|
||||
}
|
||||
|
||||
$b = new Staticexample();
|
||||
Staticexample::test();
|
||||
$b->test();
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
===DONE===
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #27598 (list() array key assignment causes HUGE memory leak)
|
||||
--FILE--
|
||||
<?php
|
||||
list($out[0]) = array(1);
|
||||
var_dump($out);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(1)
|
||||
}
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #28377 (debug_backtrace is intermittently passing args)
|
||||
--FILE--
|
||||
<?php
|
||||
function doit($a, $b)
|
||||
{
|
||||
$trace = debug_backtrace();
|
||||
custom_callback('dereferenced', $trace);
|
||||
custom_callback('direct', debug_backtrace());
|
||||
}
|
||||
|
||||
function custom_callback($traceName, $btInfo)
|
||||
{
|
||||
echo $traceName ." -- args: ";
|
||||
echo isset($btInfo[0]['args']) ? count($btInfo[0]['args']) : 'does not exist';
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
doit('a','b');
|
||||
?>
|
||||
--EXPECT--
|
||||
dereferenced -- args: 2
|
||||
direct -- args: 2
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = new stdClass();
|
||||
$x = "";
|
||||
$a->$x = "string('')";
|
||||
var_dump($a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access empty property in %sbug29015.php on line 4
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #29104 Function declaration in method doesn't work
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
function g()
|
||||
{
|
||||
echo "function g - begin\n";
|
||||
|
||||
function f()
|
||||
{
|
||||
echo "function f\n";
|
||||
}
|
||||
|
||||
echo "function g - end\n";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->g();
|
||||
f();
|
||||
?>
|
||||
--EXPECT--
|
||||
function g - begin
|
||||
function g - end
|
||||
function f
|
||||
@@ -0,0 +1,104 @@
|
||||
--TEST--
|
||||
Bug #29210 Function: is_callable - no support for private and protected classes
|
||||
--FILE--
|
||||
<?php
|
||||
class test_class {
|
||||
private function test_func1() {
|
||||
echo "test_func1\n";
|
||||
}
|
||||
protected function test_func2() {
|
||||
echo "test_func2\n";
|
||||
}
|
||||
static private function test_func3() {
|
||||
echo "test_func3\n";
|
||||
}
|
||||
static protected function test_func4() {
|
||||
echo "test_func4\n";
|
||||
}
|
||||
function test() {
|
||||
if (is_callable(array($this,'test_func1'))) {
|
||||
$this->test_func1();
|
||||
} else {
|
||||
echo "test_func1 isn't callable from inside\n";
|
||||
}
|
||||
if (is_callable(array($this,'test_func2'))) {
|
||||
$this->test_func2();
|
||||
} else {
|
||||
echo "test_func2 isn't callable from inside\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func3'))) {
|
||||
test_class::test_func3();
|
||||
} else {
|
||||
echo "test_func3 isn't callable from inside\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func4'))) {
|
||||
test_class::test_func4();
|
||||
} else {
|
||||
echo "test_func4 isn't callable from inside\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class foo extends test_class {
|
||||
function test() {
|
||||
if (is_callable(array($this,'test_func1'))) {
|
||||
$this->test_func1();
|
||||
} else {
|
||||
echo "test_func1 isn't callable from child\n";
|
||||
}
|
||||
if (is_callable(array($this,'test_func2'))) {
|
||||
$this->test_func2();
|
||||
} else {
|
||||
echo "test_func2 isn't callable from child\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func3'))) {
|
||||
test_class::test_func3();
|
||||
} else {
|
||||
echo "test_func3 isn't callable from child\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func4'))) {
|
||||
test_class::test_func4();
|
||||
} else {
|
||||
echo "test_func4 isn't callable from child\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object = new test_class;
|
||||
$object->test();
|
||||
if (is_callable(array($object,'test_func1'))) {
|
||||
$object->test_func1();
|
||||
} else {
|
||||
echo "test_func1 isn't callable from outside\n";
|
||||
}
|
||||
if (is_callable(array($object,'test_func2'))) {
|
||||
$object->test_func2();
|
||||
} else {
|
||||
echo "test_func2 isn't callable from outside\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func3'))) {
|
||||
test_class::test_func3();
|
||||
} else {
|
||||
echo "test_func3 isn't callable from outside\n";
|
||||
}
|
||||
if (is_callable(array('test_class','test_func4'))) {
|
||||
test_class::test_func4();
|
||||
} else {
|
||||
echo "test_func4 isn't callable from outside\n";
|
||||
}
|
||||
$object = new foo();
|
||||
$object->test();
|
||||
?>
|
||||
--EXPECT--
|
||||
test_func1
|
||||
test_func2
|
||||
test_func3
|
||||
test_func4
|
||||
test_func1 isn't callable from outside
|
||||
test_func2 isn't callable from outside
|
||||
test_func3 isn't callable from outside
|
||||
test_func4 isn't callable from outside
|
||||
test_func1 isn't callable from child
|
||||
test_func2
|
||||
test_func3 isn't callable from child
|
||||
test_func4
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Bug #29689 (default value of protected member overrides default value of private)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
private $foo = 'foo';
|
||||
private $foo2 = 'foo2';
|
||||
|
||||
function printFoo()
|
||||
{
|
||||
echo __CLASS__, ': ', $this->foo, " ", $this->foo2, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
protected $foo = 'bar';
|
||||
|
||||
function printFoo()
|
||||
{
|
||||
parent::printFoo();
|
||||
echo __CLASS__, ': ', $this->foo, " ", $this->foo2, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class baz extends bar {
|
||||
protected $foo = 'baz';
|
||||
protected $foo2 = 'baz2';
|
||||
}
|
||||
|
||||
class bar2 extends foo {
|
||||
function printFoo()
|
||||
{
|
||||
parent::printFoo();
|
||||
echo __CLASS__, ': ', $this->foo, " ", $this->foo2, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class baz2 extends bar2 {
|
||||
protected $foo = 'baz2';
|
||||
protected $foo2 = 'baz22';
|
||||
}
|
||||
|
||||
$bar = new bar;
|
||||
$bar->printFoo();
|
||||
echo "---baz--\n";
|
||||
$baz = new baz();
|
||||
$baz->printFoo();
|
||||
echo "---baz2--\n";
|
||||
$baz = new baz2();
|
||||
$baz->printFoo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
foo: foo foo2
|
||||
bar: bar
|
||||
Notice: Undefined property: bar::$foo2 in %s on line %d
|
||||
|
||||
---baz--
|
||||
foo: foo foo2
|
||||
bar: baz baz2
|
||||
---baz2--
|
||||
foo: foo foo2
|
||||
bar2: baz2 baz22
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #29890 (crash if error handler fails)
|
||||
--FILE--
|
||||
<?php
|
||||
function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine,&$fClass) {
|
||||
echo "error :".$fErrStr."\n";
|
||||
}
|
||||
|
||||
set_time_limit(5);
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
set_error_handler("customErrorHandler");
|
||||
|
||||
define("TEST",2);
|
||||
|
||||
//should return a notice that the constant is already defined
|
||||
|
||||
define("TEST",3);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
error :Constant TEST already defined
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #29896 (Backtrace argument list out of sync)
|
||||
--FILE--
|
||||
<?php
|
||||
function userErrorHandler($num, $msg, $file, $line, $vars)
|
||||
{
|
||||
debug_print_backtrace();
|
||||
}
|
||||
|
||||
$OldErrorHandler = set_error_handler("userErrorHandler");
|
||||
|
||||
function GenerateError1($A1)
|
||||
{
|
||||
$a = $b;
|
||||
}
|
||||
|
||||
function GenerateError2($A1)
|
||||
{
|
||||
GenerateError1("Test1");
|
||||
}
|
||||
|
||||
GenerateError2("Test2");
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11]
|
||||
#1 GenerateError1(Test1) called at [%sbug29896.php:16]
|
||||
#2 GenerateError2(Test2) called at [%sbug29896.php:19]
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #29944 (Function defined in switch, crashes)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = 1;
|
||||
switch ($a) {
|
||||
case 1:
|
||||
function foo($a) {
|
||||
return "ok\n";
|
||||
}
|
||||
echo foo($a);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #30080 (Passing array or non array of objects)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
function foo($arrayobj) {
|
||||
var_dump($arrayobj);
|
||||
}
|
||||
}
|
||||
|
||||
new foo(array(new stdClass));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(stdClass)#2 (0) {
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #30140 (Problem with array in static properties)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
public static $test1 = true;
|
||||
public static $test2 = array();
|
||||
public static $test3 = "str";
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
A::$test1 = "x";
|
||||
A::$test2 = "y";
|
||||
A::$test3 = "z";
|
||||
var_dump(A::$test1);
|
||||
var_dump(A::$test2);
|
||||
var_dump(A::$test3);
|
||||
var_dump(B::$test1);
|
||||
var_dump(B::$test2);
|
||||
var_dump(B::$test3);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "x"
|
||||
string(1) "y"
|
||||
string(1) "z"
|
||||
string(1) "x"
|
||||
string(1) "y"
|
||||
string(1) "z"
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
Bug #30162 (Catching exception in constructor couses lose of $this)
|
||||
--FILE--
|
||||
<?php
|
||||
class FIIFO {
|
||||
|
||||
public function __construct() {
|
||||
$this->x = "x";
|
||||
throw new Exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class hariCow extends FIIFO {
|
||||
|
||||
public function __construct() {
|
||||
try {
|
||||
parent::__construct();
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
$this->y = "y";
|
||||
try {
|
||||
$this->z = new FIIFO;
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return "Rusticus in asino sedet.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$db = new FIIFO();
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
var_dump($db);
|
||||
|
||||
$db = new hariCow;
|
||||
|
||||
var_dump($db);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: db in %sbug30162.php on line 35
|
||||
NULL
|
||||
object(hariCow)#1 (2) {
|
||||
["x"]=>
|
||||
string(1) "x"
|
||||
["y"]=>
|
||||
string(1) "y"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with array_push())
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=on
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class x { };
|
||||
|
||||
$first = new x;
|
||||
$second = $first;
|
||||
$container = array();
|
||||
array_push($container, $first);
|
||||
|
||||
$first->first = " im in the first";
|
||||
|
||||
print_r($first);
|
||||
print_r($second);
|
||||
print_r($container);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 4
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 5
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 7
|
||||
x Object
|
||||
(
|
||||
[first] => im in the first
|
||||
)
|
||||
x Object
|
||||
(
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => x Object
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #30394 (Assignment operators yield wrong result with __get/__set)
|
||||
--FILE--
|
||||
<?php
|
||||
class Container
|
||||
{
|
||||
public function __get( $what )
|
||||
{
|
||||
return $this->_p[ $what ];
|
||||
}
|
||||
|
||||
public function __set( $what, $value )
|
||||
{
|
||||
$this->_p[ $what ] = $value;
|
||||
}
|
||||
|
||||
private $_p = array();
|
||||
}
|
||||
|
||||
$c = new Container();
|
||||
$c->a = 1;
|
||||
$c->a += 1;
|
||||
print $c->a; // --> 2
|
||||
|
||||
print " - ";
|
||||
$c->a += max( 0, 1 );
|
||||
print $c->a; // --> 4 (!)
|
||||
?>
|
||||
--EXPECT--
|
||||
2 - 3
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #30451 (static properties permissions broken)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
|
||||
protected static $property = TRUE;
|
||||
|
||||
protected static function method() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
var_dump(self::method());
|
||||
var_dump(parent::method());
|
||||
|
||||
var_dump(self::$property);
|
||||
var_dump(parent::$property);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new B;
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #30519 Interface not existing says Class not found
|
||||
--FILE--
|
||||
<?php
|
||||
class test implements a {
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Interface 'a' not found in %sbug30519.php on line 2
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Bug #30702 cannot initialize class variable from class constant
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
const C1=1;
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
const C2=2;
|
||||
|
||||
public $c1=bar::C1;
|
||||
public $c2=bar::C2;
|
||||
|
||||
public $c3=self::C1;
|
||||
public $c4=self::C2;
|
||||
|
||||
public $c5=foo::C1;
|
||||
public $c6=parent::C1;
|
||||
}
|
||||
|
||||
$x= new bar();
|
||||
var_dump($x);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(bar)#1 (6) {
|
||||
["c1"]=>
|
||||
int(1)
|
||||
["c2"]=>
|
||||
int(2)
|
||||
["c3"]=>
|
||||
int(1)
|
||||
["c4"]=>
|
||||
int(2)
|
||||
["c5"]=>
|
||||
int(1)
|
||||
["c6"]=>
|
||||
int(1)
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #30707 (Segmentation fault on exception in method)
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
function byePHP($plop) {
|
||||
echo "ok\n";
|
||||
}
|
||||
|
||||
function plip() {
|
||||
try {
|
||||
$this->plap($this->plop());
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
function plap($a) {
|
||||
}
|
||||
|
||||
function plop() {
|
||||
throw new Exception;
|
||||
}
|
||||
}
|
||||
|
||||
$x = new C;
|
||||
$x->byePHP($x->plip());
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #30791 magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded
|
||||
--FILE--
|
||||
<?php
|
||||
class a {
|
||||
public $a = 4;
|
||||
function __call($a,$b) {
|
||||
return "unknown method";
|
||||
}
|
||||
}
|
||||
$b = new a;
|
||||
echo $b,"\n";
|
||||
$c = unserialize(serialize($b));
|
||||
echo $c,"\n";
|
||||
var_dump($c);
|
||||
?>
|
||||
--EXPECT--
|
||||
Object id #1
|
||||
Object id #2
|
||||
object(a)#2 (1) {
|
||||
["a"]=>
|
||||
int(4)
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #30820 (static member conflict with $this->member silently ignored)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class Blah {
|
||||
private static $x;
|
||||
|
||||
public function show() {
|
||||
Blah::$x = 1;
|
||||
$this->x = 5; // no warning, but refers to different variable
|
||||
|
||||
echo 'Blah::$x = '. Blah::$x ."\n";
|
||||
echo '$this->x = '. $this->x ."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$b = new Blah();
|
||||
$b->show();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 7
|
||||
Blah::$x = 1
|
||||
|
||||
Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 10
|
||||
$this->x = 5
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Bug #30828 (debug_backtrace() reports incorrect class in overridden methods)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
function __construct() {
|
||||
debug_print_backtrace();
|
||||
$bt = debug_backtrace();
|
||||
foreach ($bt as $t) {
|
||||
print $t['class'].$t['type'].$t['function']."\n";
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
debug_print_backtrace();
|
||||
$bt = debug_backtrace();
|
||||
foreach ($bt as $t) {
|
||||
print $t['class'].$t['type'].$t['function']."\n";
|
||||
}
|
||||
}
|
||||
|
||||
static function bar() {
|
||||
debug_print_backtrace();
|
||||
$bt = debug_backtrace();
|
||||
foreach ($bt as $t) {
|
||||
print $t['class'].$t['type'].$t['function']."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function foo() {
|
||||
parent::foo();
|
||||
}
|
||||
|
||||
static function bar() {
|
||||
parent::bar();
|
||||
}
|
||||
}
|
||||
|
||||
$b = new B();
|
||||
$b->foo();
|
||||
B::bar();
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 A->__construct() called at [%sbug30828.php:30]
|
||||
#1 B->__construct() called at [%sbug30828.php:42]
|
||||
A->__construct
|
||||
B->__construct
|
||||
#0 A->foo() called at [%sbug30828.php:34]
|
||||
#1 B->foo() called at [%sbug30828.php:43]
|
||||
A->foo
|
||||
B->foo
|
||||
#0 A::bar() called at [%sbug30828.php:38]
|
||||
#1 B::bar() called at [%sbug30828.php:44]
|
||||
A::bar
|
||||
B::bar
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #30889 Conflict between __get/__set and ++ operator
|
||||
--FILE--
|
||||
<?php
|
||||
class overloaded
|
||||
{
|
||||
private $values;
|
||||
function __construct()
|
||||
{
|
||||
$this->values = array('a' => 0);
|
||||
}
|
||||
function __set($name, $value)
|
||||
{
|
||||
print "set $name = $value ($name was ".$this->values[$name].")\n";
|
||||
$this->values[$name] = $value;
|
||||
}
|
||||
function __get($name)
|
||||
{
|
||||
print "get $name (returns ".$this->values[$name].")\n";
|
||||
return $this->values[$name];
|
||||
}
|
||||
}
|
||||
$test = new overloaded();
|
||||
$test->a++; // __get(), then __set()
|
||||
++$test->a;
|
||||
?>
|
||||
--EXPECT--
|
||||
get a (returns 0)
|
||||
set a = 1 (a was 0)
|
||||
get a (returns 1)
|
||||
set a = 2 (a was 1)
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
--TEST--
|
||||
Bug #31177 (Memory leak)
|
||||
--FILE--
|
||||
<?php
|
||||
class DbGow {
|
||||
|
||||
public function query() {
|
||||
throw new Exception;
|
||||
}
|
||||
|
||||
public function select() {
|
||||
return new DbGowRecordSet($this->query());
|
||||
}
|
||||
|
||||
public function select2() {
|
||||
new DbGowRecordSet($this->query());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DbGowRecordSet {
|
||||
|
||||
public function __construct($resource) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$db = new DbGow;
|
||||
|
||||
try {
|
||||
$rs = $db->select();
|
||||
} catch(Exception $e) {
|
||||
echo "ok\n";
|
||||
}
|
||||
|
||||
try {
|
||||
$db->select2();
|
||||
} catch(Exception $e) {
|
||||
echo "ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
ok
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #31525 (object reference being dropped. $this getting lost)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
function getThis() {
|
||||
return $this;
|
||||
}
|
||||
function destroyThis() {
|
||||
$baz =& $this->getThis();
|
||||
}
|
||||
}
|
||||
$bar = new Foo();
|
||||
$bar->destroyThis();
|
||||
var_dump($bar);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Only variables should be assigned by reference in %sbug31525.php on line 7
|
||||
object(Foo)#1 (0) {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #31828 (Crash with zend.ze1_compatibility_mode=On)
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=on
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
$o = new stdClass();
|
||||
$o->id = 77;
|
||||
$o->name = "Aerospace";
|
||||
$a[] = $o;
|
||||
$a = $a[0];
|
||||
print_r($a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 2
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 5
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 6
|
||||
stdClass Object
|
||||
(
|
||||
[id] => 77
|
||||
[name] => Aerospace
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #32080 (segfault when assigning object to itself with zend.ze1_compatibility_mode=On)
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=on
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class test { }
|
||||
$t = new test;
|
||||
$t = $t; // gives segfault
|
||||
var_dump($t);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 3
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 5
|
||||
object(test)#%d (0) {
|
||||
}
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
Bug #32252 (Segfault when offsetSet throws an Exception (only without debug))
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test implements ArrayAccess
|
||||
{
|
||||
function offsetExists($offset)
|
||||
{
|
||||
echo __METHOD__ . "($offset)\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
function offsetGet($offset)
|
||||
{
|
||||
echo __METHOD__ . "($offset)\n";
|
||||
return null;
|
||||
}
|
||||
|
||||
function offsetSet($offset, $value)
|
||||
{
|
||||
echo __METHOD__ . "($offset, $value)\n";
|
||||
throw new Exception("Ooops");
|
||||
}
|
||||
|
||||
function offsetUnset($offset)
|
||||
{
|
||||
echo __METHOD__ . "($offset)\n";
|
||||
}
|
||||
}
|
||||
|
||||
$list = new Test();
|
||||
try
|
||||
{
|
||||
$list[-1] = 123;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
echo "CAUGHT\n";
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
Test::offsetSet(-1, 123)
|
||||
CAUGHT
|
||||
===DONE===
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
--TEST--
|
||||
Bug #32296 get_class_methods output has changed between 5.0.2 and 5.0.3
|
||||
--FILE--
|
||||
<?php
|
||||
abstract class space{
|
||||
function __construct(){}
|
||||
abstract protected function unfold();
|
||||
}
|
||||
|
||||
abstract class shape extends space{
|
||||
private function x1() {}
|
||||
protected final function unfold(){}
|
||||
}
|
||||
|
||||
abstract class quad extends shape{
|
||||
private function x2() {}
|
||||
function buggy(){
|
||||
$c = get_class($this);
|
||||
$a = get_class_methods(get_class($this));
|
||||
$b = get_class_methods($this);
|
||||
print($c."\n".'a:');
|
||||
print_r($a);
|
||||
print('b:');
|
||||
print_r($b);
|
||||
}
|
||||
}
|
||||
|
||||
class square extends quad{}
|
||||
|
||||
$a = new square();
|
||||
$a->buggy();
|
||||
print_r(get_class_methods("square"));
|
||||
print_r(get_class_methods($a));
|
||||
?>
|
||||
--EXPECT--
|
||||
square
|
||||
a:Array
|
||||
(
|
||||
[0] => x2
|
||||
[1] => buggy
|
||||
[2] => unfold
|
||||
[3] => __construct
|
||||
)
|
||||
b:Array
|
||||
(
|
||||
[0] => x2
|
||||
[1] => buggy
|
||||
[2] => unfold
|
||||
[3] => __construct
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => buggy
|
||||
[1] => __construct
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => buggy
|
||||
[1] => __construct
|
||||
)
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
--TEST--
|
||||
Bug #32322 (Return values by reference broken( using self::),example singleton instance)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class test
|
||||
{
|
||||
private static $instance = null;
|
||||
private $myname = '';
|
||||
|
||||
private function __construct( $value = '' )
|
||||
{
|
||||
echo "New class $value created \n";
|
||||
$this -> myname = $value;
|
||||
}
|
||||
private function __clone() {}
|
||||
static public function getInstance()
|
||||
{
|
||||
if ( self::$instance == null )
|
||||
{
|
||||
self::$instance = new test('Singleton1');
|
||||
}
|
||||
else {
|
||||
echo "Using old class " . self::$instance -> myname . "\n";
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
static public function getInstance2()
|
||||
{
|
||||
static $instance2 = null;
|
||||
if ( $instance2 == null )
|
||||
{
|
||||
$instance2 = new test('Singleton2');
|
||||
}
|
||||
else {
|
||||
echo "Using old class " . $instance2 -> myname . "\n";
|
||||
}
|
||||
return $instance2;
|
||||
}
|
||||
public function __destruct()
|
||||
{
|
||||
if ( defined('SCRIPT_END') )
|
||||
{
|
||||
echo "Class " . $this -> myname . " destroyed at script end\n";
|
||||
} else {
|
||||
echo "Class " . $this -> myname . " destroyed beforce script end\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "Try static instance inside class :\n";
|
||||
$getCopyofSingleton = test::getInstance();
|
||||
$getCopyofSingleton = null;
|
||||
$getCopyofSingleton = &test::getInstance();
|
||||
$getCopyofSingleton = null;
|
||||
$getCopyofSingleton = test::getInstance();
|
||||
echo "Try static instance inside function :\n";
|
||||
$getCopyofSingleton2 = test::getInstance2();
|
||||
$getCopyofSingleton2 = null;
|
||||
$getCopyofSingleton2 = &test::getInstance2();
|
||||
$getCopyofSingleton2 = null;
|
||||
$getCopyofSingleton2 = test::getInstance2();
|
||||
|
||||
define('SCRIPT_END',1);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Try static instance inside class :
|
||||
New class Singleton1 created
|
||||
Using old class Singleton1
|
||||
|
||||
Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 49
|
||||
Using old class Singleton1
|
||||
Try static instance inside function :
|
||||
New class Singleton2 created
|
||||
Using old class Singleton2
|
||||
|
||||
Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 55
|
||||
Using old class Singleton2
|
||||
Class Singleton1 destroyed at script end
|
||||
Class Singleton2 destroyed at script end
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct)
|
||||
--FILE--
|
||||
<?php
|
||||
class BUG {
|
||||
public $error = "please fix this thing, it wasted a nice part of my life!\n";
|
||||
static function instance() {return new BUG();}
|
||||
|
||||
function __destruct()
|
||||
{
|
||||
$c=get_class($this); unset($c);
|
||||
echo get_class($this) ."\n";
|
||||
if(defined('DEBUG_'.__CLASS__)){}
|
||||
$c=get_class($this); //memory leak only
|
||||
echo $this->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BUG::instance()->error;
|
||||
echo "this is still executed\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
BUG
|
||||
please fix this thing, it wasted a nice part of my life!
|
||||
this is still executed
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #32660 Assignment by reference causes crash when field access is overloaded (__get)
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
public $q;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->q = 3;//array();
|
||||
}
|
||||
|
||||
function __get($name)
|
||||
{
|
||||
return $this->q;
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
|
||||
$b = "short";
|
||||
$c =& $a->whatever;
|
||||
$c = "long";
|
||||
print_r($a);
|
||||
$a->whatever =& $b;
|
||||
$b = "much longer";
|
||||
print_r($a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
A Object
|
||||
(
|
||||
[q] => long
|
||||
)
|
||||
|
||||
Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23
|
||||
@@ -0,0 +1,62 @@
|
||||
--TEST--
|
||||
Bug #32674 exception in iterator causes crash
|
||||
--FILE--
|
||||
<?php
|
||||
class collection implements Iterator {
|
||||
|
||||
private $_elements = array();
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function rewind() {
|
||||
reset($this->_elements);
|
||||
}
|
||||
|
||||
public function count() {
|
||||
return count($this->_elements);
|
||||
}
|
||||
|
||||
public function current() {
|
||||
$element = current($this->_elements);
|
||||
return $element;
|
||||
}
|
||||
|
||||
public function next() {
|
||||
$element = next($this->_elements);
|
||||
return $element;
|
||||
}
|
||||
|
||||
public function key() {
|
||||
$this->_fillCollection();
|
||||
$element = key($this->_elements);
|
||||
return $element;
|
||||
}
|
||||
|
||||
public function valid() {
|
||||
throw new Exception('shit happend');
|
||||
|
||||
return ($this->current() !== false);
|
||||
}
|
||||
}
|
||||
|
||||
class class2 {
|
||||
public $dummy;
|
||||
}
|
||||
|
||||
$obj = new class2();
|
||||
$col = new collection();
|
||||
|
||||
try {
|
||||
foreach($col as $co) {
|
||||
//irrelevant
|
||||
}
|
||||
echo 'shouldn`t get here';
|
||||
//$dummy = 'this will not crash';
|
||||
$obj->dummy = 'this will crash';
|
||||
} catch (Exception $e) {
|
||||
echo "ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #32799 (crash: calling the corresponding global var during the destruct)
|
||||
--FILE--
|
||||
<?php
|
||||
class test{
|
||||
public $c=1;
|
||||
function __destruct (){
|
||||
$GLOBALS['p']->c++; // no warning
|
||||
print $GLOBALS['p']->c."\n"; // segfault
|
||||
var_dump($GLOBALS['p']);
|
||||
}
|
||||
}
|
||||
$p=new test;
|
||||
$p=null; //destroy the object by a new assignment (segfault)
|
||||
?>
|
||||
--EXPECT--
|
||||
2
|
||||
object(test)#1 (1) {
|
||||
["c"]=>
|
||||
int(2)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #32852 (Crash with singleton and __destruct when zend.ze1_compatibility_mode = On)
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=on
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
class crashme {
|
||||
private static $instance = null;
|
||||
|
||||
public function __construct() {
|
||||
self::$instance = $this;
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
echo "i'm called\n";
|
||||
}
|
||||
|
||||
public static function singleton() {
|
||||
if (!isset(self::$instance)) {
|
||||
self::$instance = new crashme();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
crashme::singleton();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 6
|
||||
i'm called
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 15
|
||||
i'm called
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 17
|
||||
i'm called
|
||||
i'm called
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #32993 (implemented Iterator function current() don't throw exception)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test implements Iterator {
|
||||
|
||||
public $arr = array();
|
||||
|
||||
public function rewind() { return reset($this->arr); }
|
||||
public function current() { throw new Exception(); }
|
||||
public function key() { return key($this->arr); }
|
||||
public function next() { return next($this->arr); }
|
||||
public function valid() { return (current($this->arr) !== false); }
|
||||
}
|
||||
|
||||
$t = new Test();
|
||||
$t->arr = array(1, 2, 3);
|
||||
|
||||
try {
|
||||
foreach ($t as $v) {
|
||||
echo "$v\n";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
; // handle exception
|
||||
}
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #33116 (crash when assigning class name to global variable in __autoload)
|
||||
--FILE--
|
||||
<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
$GLOBALS['include'][] = $class;
|
||||
eval("class DefClass{}");
|
||||
}
|
||||
|
||||
$a = new DefClass;
|
||||
print_r($a);
|
||||
print_r($GLOBALS['include']);
|
||||
?>
|
||||
--EXPECT--
|
||||
DefClass Object
|
||||
(
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => DefClass
|
||||
)
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #33171 (foreach enumerates private fields declared in base classes)
|
||||
--FILE--
|
||||
<?php
|
||||
class A
|
||||
{
|
||||
private $c = "A's c";
|
||||
}
|
||||
|
||||
class B extends A
|
||||
{
|
||||
private $c = "B's c";
|
||||
|
||||
public function go()
|
||||
{
|
||||
foreach ($this as $key => $val)
|
||||
{
|
||||
echo "$key => $val\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$x = new B;
|
||||
$x->go();
|
||||
?>
|
||||
--EXPECT--
|
||||
c => B's c
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #33243 (ze1_compatibility_mode does not work as expected)
|
||||
--INI--
|
||||
zend.ze1_compatibility_mode=1
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
$a->y->z = 0;
|
||||
$b = $a; // should perform deep copy of $a
|
||||
$b->y->z = 1; // hence this should have no effect on $a
|
||||
var_dump($a);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Strict Standards: Creating default object from empty value in %sbug33243.php on line 2
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 3
|
||||
|
||||
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 5
|
||||
object(stdClass)#%d (1) {
|
||||
["y"]=>
|
||||
object(stdClass)#%d (1) {
|
||||
["z"]=>
|
||||
int(0)
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #33257 array_splice() inconsistent when passed function instead of variable
|
||||
--FILE--
|
||||
<?php
|
||||
class X {
|
||||
protected static $arr = array("a", "b", "c");
|
||||
public static function getArr() {
|
||||
return self::$arr;
|
||||
}
|
||||
}
|
||||
|
||||
//$arr1 = X::getArr();
|
||||
array_splice(X::getArr(), 1, 1);
|
||||
print_r(X::getArr());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Only variables can be passed by reference in %sbug33257.php on line 10
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
Bug #33277 (private method accessed by child class)
|
||||
--FILE--
|
||||
<?
|
||||
class foo {
|
||||
private function bar() {
|
||||
echo "private!\n";
|
||||
}
|
||||
}
|
||||
|
||||
class fooson extends foo {
|
||||
function barson() {
|
||||
$this->bar();
|
||||
}
|
||||
}
|
||||
|
||||
class foo2son extends fooson {
|
||||
|
||||
function bar() {
|
||||
echo "public!\n";
|
||||
}
|
||||
}
|
||||
|
||||
$b = new foo2son();
|
||||
$b->barson();
|
||||
?>
|
||||
--EXPECT--
|
||||
public!
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #33558 (warning with nested calls to functions returning by reference)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
--FILE--
|
||||
<?php
|
||||
function & foo() {
|
||||
$var = 'ok';
|
||||
return $var;
|
||||
}
|
||||
|
||||
function & bar() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
$a =& bar();
|
||||
echo "$a\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #33802 (throw Exception in error handler causes crash)
|
||||
--FILE--
|
||||
<?php
|
||||
set_error_handler('errorHandler', E_USER_ERROR);
|
||||
try{
|
||||
test();
|
||||
}catch(Exception $e){
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
function test(){
|
||||
trigger_error("error", E_USER_ERROR);
|
||||
}
|
||||
|
||||
function errorHandler($errno, $errstr, $errfile, $errline) {
|
||||
throw new Exception();
|
||||
}
|
||||
?>
|
||||
ok
|
||||
--EXPECT--
|
||||
ok
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #34064 (arr[] as param to function in class gives invalid opcode)
|
||||
--FILE--
|
||||
<?php
|
||||
class XmlTest {
|
||||
|
||||
function test_ref(&$test)
|
||||
{
|
||||
$test = "ok";
|
||||
}
|
||||
|
||||
function test($test)
|
||||
{
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
$ar = array();
|
||||
$this->test_ref($ar[]);
|
||||
var_dump($ar);
|
||||
$this->test($ar[]);
|
||||
}
|
||||
}
|
||||
|
||||
$o = new XmlTest();
|
||||
$o->run();
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(2) "ok"
|
||||
}
|
||||
|
||||
Fatal error: Cannot use [] for reading in %sbug34064.php on line 18
|
||||
|
||||
Executable
+171
@@ -0,0 +1,171 @@
|
||||
--TEST--
|
||||
Magic object handlers segfault and memory errors
|
||||
--FILE--
|
||||
<?php
|
||||
function f($x) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
class foo implements ArrayAccess {
|
||||
function __get($property) {
|
||||
$GLOBALS["y"] = $property;
|
||||
}
|
||||
function __set($property, $value) {
|
||||
$GLOBALS["y"] = $property;
|
||||
}
|
||||
function __call($func, $args) {
|
||||
$GLOBALS["y"] = $func;
|
||||
}
|
||||
function offsetGet($index) {
|
||||
$GLOBALS["y"] = $index;
|
||||
}
|
||||
function offsetSet($index, $newval) {
|
||||
$GLOBALS["y"] = $index;
|
||||
}
|
||||
function offsetExists($index) {
|
||||
$GLOBALS["y"] = $index;
|
||||
}
|
||||
function offsetUnset($index) {
|
||||
$GLOBALS["y"] = $index;
|
||||
}
|
||||
}
|
||||
|
||||
$x = new foo();
|
||||
$y = null;
|
||||
|
||||
// IS_CONST
|
||||
$z = $x->const_get;
|
||||
echo $y,"\n";
|
||||
$x->const_set = 1;
|
||||
echo $y,"\n";
|
||||
$x->const_call();
|
||||
echo $y,"\n";
|
||||
$z = $x["const_dim_get"];
|
||||
echo $y,"\n";
|
||||
$x["const_dim_set"] = 1;
|
||||
echo $y,"\n";
|
||||
isset($x["const_dim_isset"]);
|
||||
echo $y,"\n";
|
||||
unset($x["const_dim_unset"]);
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_CONST + conversion
|
||||
$z = $x->{1};
|
||||
echo $y,"\n";
|
||||
$x->{2} = 1;
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_TMP_VAR
|
||||
$c = "tmp";
|
||||
$z = $x->{$c."_get"};
|
||||
echo $y,"\n";
|
||||
$x->{$c."_set"} = 1;
|
||||
echo $y,"\n";
|
||||
$x->{$c."_call"}();
|
||||
echo $y,"\n";
|
||||
$z = $x[$c."_dim_get"];
|
||||
echo $y,"\n";
|
||||
$x[$c."_dim_set"] = 1;
|
||||
echo $y,"\n";
|
||||
isset($x[$c."_dim_isset"]);
|
||||
echo $y,"\n";
|
||||
unset($x[$c."_dim_unset"]);
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_TMP_VAR + conversion
|
||||
$c = 0;
|
||||
$z = $x->{$c+3};
|
||||
echo $y,"\n";
|
||||
$x->{$c+4} = 1;
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_CV
|
||||
$c = "cv_get";
|
||||
$z = $x->{$c};
|
||||
echo $y,"\n";
|
||||
$c = "cv_set";
|
||||
$x->{$c} = 1;
|
||||
echo $y,"\n";
|
||||
$c = "cv_call";
|
||||
$x->{$c}();
|
||||
echo $y,"\n";
|
||||
$c = "cv_dim_get";
|
||||
$z = $x[$c];
|
||||
echo $y,"\n";
|
||||
$c = "cv_dim_set";
|
||||
$x[$c] = 1;
|
||||
echo $y,"\n";
|
||||
$c = "cv_dim_isset";
|
||||
isset($x[$c]);
|
||||
echo $y,"\n";
|
||||
$c = "cv_dim_unset";
|
||||
unset($x[$c]);
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_CV + conversion
|
||||
$c = 5;
|
||||
$z = $x->{$c};
|
||||
echo $y,"\n";
|
||||
$c = 6;
|
||||
$x->{$c} = 1;
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_VAR
|
||||
$z = $x->{f("var_get")};
|
||||
echo $y,"\n";
|
||||
$x->{f("var_set")} = 1;
|
||||
echo $y,"\n";
|
||||
$x->{f("var_call")}();
|
||||
echo $y,"\n";
|
||||
$z = $x[f("var_dim_get")];
|
||||
echo $y,"\n";
|
||||
$x[f("var_dim_set")] = 1;
|
||||
echo $y,"\n";
|
||||
isset($x[f("var_dim_isset")]);
|
||||
echo $y,"\n";
|
||||
unset($x[f("var_dim_unset")]);
|
||||
echo $y,"\n";
|
||||
|
||||
// IS_VAR + conversion
|
||||
$z = $x->{f(7)};
|
||||
echo $y,"\n";
|
||||
$x->{f(8)} = 1;
|
||||
echo $y,"\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
const_get
|
||||
const_set
|
||||
const_call
|
||||
const_dim_get
|
||||
const_dim_set
|
||||
const_dim_isset
|
||||
const_dim_unset
|
||||
1
|
||||
2
|
||||
tmp_get
|
||||
tmp_set
|
||||
tmp_call
|
||||
tmp_dim_get
|
||||
tmp_dim_set
|
||||
tmp_dim_isset
|
||||
tmp_dim_unset
|
||||
3
|
||||
4
|
||||
cv_get
|
||||
cv_set
|
||||
cv_call
|
||||
cv_dim_get
|
||||
cv_dim_set
|
||||
cv_dim_isset
|
||||
cv_dim_unset
|
||||
5
|
||||
6
|
||||
var_get
|
||||
var_set
|
||||
var_call
|
||||
var_dim_get
|
||||
var_dim_set
|
||||
var_dim_isset
|
||||
var_dim_unset
|
||||
7
|
||||
8
|
||||
+15
-20
@@ -803,6 +803,13 @@ void zend_deactivate_modules(TSRMLS_D)
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
void zend_call_destructors(TSRMLS_D)
|
||||
{
|
||||
zend_try {
|
||||
shutdown_destructors(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
void zend_deactivate(TSRMLS_D)
|
||||
{
|
||||
/* we're no longer executing anything */
|
||||
@@ -820,6 +827,8 @@ void zend_deactivate(TSRMLS_D)
|
||||
shutdown_compiler(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
|
||||
|
||||
zend_try {
|
||||
zend_ini_deactivate(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
@@ -872,8 +881,6 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
char *error_filename;
|
||||
uint error_lineno;
|
||||
zval *orig_user_error_handler;
|
||||
zval *orig_garbage[2];
|
||||
int orig_garbage_ptr;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
/* Obtain relevant filename and lineno */
|
||||
@@ -962,7 +969,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
|
||||
z_context->value.ht = EG(active_symbol_table);
|
||||
z_context->type = IS_ARRAY;
|
||||
ZVAL_ADDREF(z_context); /* we don't want this one to be freed */
|
||||
zval_copy_ctor(z_context);
|
||||
|
||||
params = (zval ***) emalloc(sizeof(zval **)*5);
|
||||
params[0] = &z_error_type;
|
||||
@@ -974,12 +981,6 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
orig_user_error_handler = EG(user_error_handler);
|
||||
EG(user_error_handler) = NULL;
|
||||
|
||||
orig_garbage_ptr = EG(garbage_ptr);
|
||||
EG(garbage_ptr) = 0;
|
||||
if (orig_garbage_ptr > 0) {
|
||||
memcpy(&orig_garbage, &EG(garbage), sizeof(zval*)*orig_garbage_ptr);
|
||||
}
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) {
|
||||
if (retval) {
|
||||
if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
|
||||
@@ -992,24 +993,18 @@ ZEND_API void zend_error(int type, const char *format, ...)
|
||||
zend_error_cb(type, error_filename, error_lineno, format, args);
|
||||
}
|
||||
|
||||
if (orig_garbage_ptr > 0) {
|
||||
while (EG(garbage_ptr)) {
|
||||
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
|
||||
}
|
||||
EG(garbage_ptr) = orig_garbage_ptr;
|
||||
memcpy(&EG(garbage), &orig_garbage, sizeof(zval*)*orig_garbage_ptr);
|
||||
if (!EG(user_error_handler)) {
|
||||
EG(user_error_handler) = orig_user_error_handler;
|
||||
} else {
|
||||
zval_ptr_dtor(&orig_user_error_handler);
|
||||
}
|
||||
|
||||
EG(user_error_handler) = orig_user_error_handler;
|
||||
|
||||
efree(params);
|
||||
zval_ptr_dtor(&z_error_message);
|
||||
zval_ptr_dtor(&z_error_type);
|
||||
zval_ptr_dtor(&z_error_filename);
|
||||
zval_ptr_dtor(&z_error_lineno);
|
||||
if (ZVAL_REFCOUNT(z_context) == 2) {
|
||||
FREE_ZVAL(z_context);
|
||||
}
|
||||
zval_ptr_dtor(&z_context);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.4-dev"
|
||||
#define ZEND_VERSION "2.0.5"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -452,6 +452,7 @@ END_EXTERN_C()
|
||||
|
||||
void zend_activate(TSRMLS_D);
|
||||
void zend_deactivate(TSRMLS_D);
|
||||
void zend_call_destructors(TSRMLS_D);
|
||||
void zend_activate_modules(TSRMLS_D);
|
||||
void zend_deactivate_modules(TSRMLS_D);
|
||||
void zend_post_deactivate_modules(TSRMLS_D);
|
||||
|
||||
+95
-19
@@ -152,7 +152,29 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
|
||||
}
|
||||
|
||||
while (param_count-->0) {
|
||||
*(argument_array++) = (zval **) p-(arg_count--);
|
||||
zval **value = (zval**)(p-arg_count);
|
||||
|
||||
if (EG(ze1_compatibility_mode) && Z_TYPE_PP(value) == IS_OBJECT) {
|
||||
zval *value_ptr;
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(*value, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
ALLOC_ZVAL(value_ptr);
|
||||
*value_ptr = **value;
|
||||
INIT_PZVAL(value_ptr);
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
|
||||
if(!dup) {
|
||||
efree(class_name);
|
||||
}
|
||||
value_ptr->value.obj = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC);
|
||||
zval_ptr_dtor(value);
|
||||
*value = value_ptr;
|
||||
}
|
||||
*(argument_array++) = value;
|
||||
arg_count--;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -161,7 +183,10 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D)
|
||||
{
|
||||
zend_error(E_WARNING, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C));
|
||||
char *space;
|
||||
char *class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
|
||||
zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +234,20 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
/* returns 1 if you need to copy result, 0 if it's already a copy */
|
||||
ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC)
|
||||
{
|
||||
if (Z_OBJ_HT_P(object)->get_class_name == NULL ||
|
||||
Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) {
|
||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
||||
|
||||
*class_name = ce->name;
|
||||
*class_name_len = ce->name_length;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
{
|
||||
@@ -452,8 +491,10 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
|
||||
expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC);
|
||||
if (expected_type) {
|
||||
if (!quiet) {
|
||||
zend_error(E_WARNING, "%s() expects parameter %d to be %s, %s given",
|
||||
get_active_function_name(TSRMLS_C), arg_num, expected_type,
|
||||
char *space;
|
||||
char *class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given",
|
||||
class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type,
|
||||
zend_zval_type_name(*arg));
|
||||
}
|
||||
return FAILURE;
|
||||
@@ -690,8 +731,13 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
|
||||
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
if (!class_type->constants_updated) {
|
||||
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
|
||||
zend_class_entry *old_scope = *scope;
|
||||
|
||||
*scope = class_type;
|
||||
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
*scope = old_scope;
|
||||
class_type->constants_updated = 1;
|
||||
}
|
||||
}
|
||||
@@ -1305,7 +1351,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
if (ptr->flags) {
|
||||
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
|
||||
internal_function->fn_flags |= ZEND_ACC_PUBLIC;
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC;
|
||||
} else {
|
||||
internal_function->fn_flags = ptr->flags;
|
||||
}
|
||||
@@ -1712,7 +1758,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name)
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name)
|
||||
{
|
||||
char *lcname;
|
||||
zend_bool retval = 0;
|
||||
@@ -1723,7 +1769,7 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
if (callable_name) {
|
||||
*callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
||||
}
|
||||
if (syntax_only) {
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1760,7 +1806,7 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
|
||||
}
|
||||
|
||||
if (syntax_only)
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
|
||||
return 1;
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
@@ -1789,14 +1835,27 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
|
||||
}
|
||||
|
||||
if (syntax_only)
|
||||
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ce) {
|
||||
zend_function *fbc;
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), Z_STRLEN_PP(method));
|
||||
if (zend_hash_exists(&ce->function_table, lcname, Z_STRLEN_PP(method)+1)) {
|
||||
if (zend_hash_find(&ce->function_table, lcname, Z_STRLEN_PP(method)+1, (void **)&fbc) == SUCCESS) {
|
||||
retval = 1;
|
||||
if ((check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
|
||||
if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
if (!zend_check_private(fbc, (Z_TYPE_PP(obj) == IS_STRING)?EG(scope):(*obj)->value.obj.handlers->get_class_entry(*obj TSRMLS_CC), lcname, Z_STRLEN_PP(method) TSRMLS_CC)) {
|
||||
retval = 0;
|
||||
}
|
||||
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
|
||||
if (!zend_check_protected(fbc->common.scope, EG(scope))) {
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* check for __call too */
|
||||
if (retval == 0 && ce->__call != 0) {
|
||||
@@ -1828,8 +1887,10 @@ ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char
|
||||
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC)
|
||||
{
|
||||
char *lcname, *func;
|
||||
char *lcname, *func, *class_name;
|
||||
zend_bool retval = 0;
|
||||
zend_class_entry **pce;
|
||||
int class_name_len;
|
||||
|
||||
if (zend_is_callable(callable, 0, callable_name)) {
|
||||
return 1;
|
||||
@@ -1839,12 +1900,18 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
|
||||
|
||||
if ((func = strstr(lcname, "::")) != NULL) {
|
||||
zval_dtor(callable);
|
||||
array_init(callable);
|
||||
add_next_index_stringl(callable, lcname, func - lcname, 1);
|
||||
func += 2;
|
||||
add_next_index_stringl(callable, func, strlen(func), 1);
|
||||
retval = 1;
|
||||
*func = '\0';
|
||||
class_name_len = func - lcname;
|
||||
class_name = estrndup(Z_STRVAL_P(callable), class_name_len);
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == SUCCESS) {
|
||||
zval_dtor(callable);
|
||||
array_init(callable);
|
||||
add_next_index_stringl(callable, lcname, class_name_len, 1);
|
||||
func += 2;
|
||||
add_next_index_stringl(callable, func, strlen(func), 1);
|
||||
retval = 1;
|
||||
}
|
||||
efree(class_name);
|
||||
}
|
||||
efree(lcname);
|
||||
break;
|
||||
@@ -1984,7 +2051,12 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
|
||||
EG(scope) = scope;
|
||||
|
||||
if (!Z_OBJ_HT_P(object)->write_property) {
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", Z_OBJCE_P(object)->name, name);
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
|
||||
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name);
|
||||
}
|
||||
ZVAL_STRINGL(&property, name, name_length, 0);
|
||||
Z_OBJ_HT_P(object)->write_property(object, &property, value TSRMLS_CC);
|
||||
@@ -2033,7 +2105,11 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
|
||||
EG(scope) = scope;
|
||||
|
||||
if (!Z_OBJ_HT_P(object)->read_property) {
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", Z_OBJCE_P(object)->name, name);
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
|
||||
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
|
||||
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name);
|
||||
}
|
||||
ZVAL_STRINGL(&property, name, name_length, 0);
|
||||
value = Z_OBJ_HT_P(object)->read_property(object, &property, silent TSRMLS_CC);
|
||||
|
||||
+6
-1
@@ -179,7 +179,11 @@ ZEND_API int zend_disable_function(char *function_name, uint function_name_lengt
|
||||
ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_wrong_param_count(TSRMLS_D);
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
|
||||
|
||||
#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
|
||||
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
|
||||
|
||||
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
|
||||
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
|
||||
ZEND_API char *zend_get_module_version(char *module_name);
|
||||
ZEND_API int zend_get_module_started(char *module_name);
|
||||
@@ -197,6 +201,7 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object,
|
||||
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
|
||||
ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
|
||||
|
||||
#define getThis() (this_ptr)
|
||||
|
||||
|
||||
+2
-2
@@ -75,7 +75,8 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
|
||||
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
|
||||
if (AG(memory_limit)<AG(allocated_memory)) {\
|
||||
int php_mem_limit = AG(memory_limit); \
|
||||
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
|
||||
AG(allocated_memory) -= rs; \
|
||||
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory)) { \
|
||||
AG(memory_limit) = AG(allocated_memory) + 1048576; \
|
||||
if (file) { \
|
||||
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
|
||||
@@ -388,7 +389,6 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
char *p;
|
||||
|
||||
+6
-12
@@ -85,8 +85,6 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
|
||||
|
||||
#define USE_ZEND_ALLOC 1
|
||||
|
||||
#if USE_ZEND_ALLOC
|
||||
|
||||
/* Standard wrapper macros */
|
||||
@@ -124,15 +122,12 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size)))
|
||||
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
|
||||
|
||||
#else
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#undef _GNU_SOURCE
|
||||
|
||||
|
||||
/* Standard wrapper macros */
|
||||
#define emalloc(size) malloc(size)
|
||||
#define safe_emalloc(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
@@ -141,7 +136,7 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define erealloc(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup(s) strdup(s)
|
||||
#define estrndup(s, length) strndup((s), (length))
|
||||
#define estrndup(s, length) zend_strndup((s), (length))
|
||||
|
||||
/* Relay wrapper macros */
|
||||
#define emalloc_rel(size) malloc(size)
|
||||
@@ -151,7 +146,7 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define erealloc_rel(ptr, size) realloc((ptr), (size))
|
||||
#define erealloc_recoverable_rel(ptr, size) realloc((ptr), (size))
|
||||
#define estrdup_rel(s) strdup(s)
|
||||
#define estrndup_rel(s, length) strndup((s), (length))
|
||||
#define estrndup_rel(s, length) zend_strndup((s), (length))
|
||||
|
||||
/* Selective persistent/non persistent allocation macros */
|
||||
#define pemalloc(size, persistent) malloc(size)
|
||||
@@ -167,11 +162,10 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#define perealloc_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable_rel(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup_rel(s, persistent) strdup(s)
|
||||
#endif /* !USE_ZEND_ALLOC */
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(strndup((ptr), (len))):(empty_string))
|
||||
|
||||
#endif
|
||||
#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
|
||||
+113
-43
@@ -523,6 +523,7 @@ ZEND_FUNCTION(get_class)
|
||||
zval **arg;
|
||||
char *name = "";
|
||||
zend_uint name_len = 0;
|
||||
int dup;
|
||||
|
||||
if (!ZEND_NUM_ARGS()) {
|
||||
if (EG(scope)) {
|
||||
@@ -538,19 +539,9 @@ ZEND_FUNCTION(get_class)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (Z_OBJ_HT_PP(arg)->get_class_name == NULL ||
|
||||
Z_OBJ_HT_PP(arg)->get_class_name(*arg, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
|
||||
zend_class_entry *ce;
|
||||
dup = zend_get_object_classname(*arg, &name, &name_len TSRMLS_CC);
|
||||
|
||||
ce = zend_get_class_entry(*arg TSRMLS_CC);
|
||||
if (!ce) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_STRINGL(ce->name, ce->name_length, 1);
|
||||
}
|
||||
|
||||
RETURN_STRINGL(name, name_len, 0);
|
||||
RETURN_STRINGL(name, name_len, dup);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -802,7 +793,6 @@ ZEND_FUNCTION(get_class_methods)
|
||||
zend_class_entry *ce = NULL, **pce;
|
||||
HashPosition pos;
|
||||
zend_function *mptr;
|
||||
int instanceof;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -824,14 +814,16 @@ ZEND_FUNCTION(get_class_methods)
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
instanceof = EG(scope) && instanceof_function(EG(scope), ce TSRMLS_CC);
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
|
||||
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
|
||||
|| (instanceof && ((mptr->common.fn_flags & ZEND_ACC_PROTECTED) || EG(scope) == mptr->common.scope))) {
|
||||
|| (EG(scope) &&
|
||||
(((mptr->common.fn_flags & ZEND_ACC_PROTECTED) &&
|
||||
instanceof_function(EG(scope), mptr->common.scope TSRMLS_CC))
|
||||
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
|
||||
EG(scope) == mptr->common.scope)))) {
|
||||
MAKE_STD_ZVAL(method_name);
|
||||
ZVAL_STRING(method_name, mptr->common.function_name, 1);
|
||||
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);
|
||||
@@ -1528,6 +1520,12 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC)
|
||||
(*arg)->refcount++;
|
||||
add_next_index_zval(arg_array, *arg);
|
||||
}
|
||||
|
||||
/* skip args from incomplete frames */
|
||||
while ((((*curpos)-1) > EG(argument_stack).elements) && *((*curpos)-1)) {
|
||||
(*curpos)--;
|
||||
}
|
||||
|
||||
return arg_array;
|
||||
}
|
||||
|
||||
@@ -1550,7 +1548,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC)
|
||||
/* {{{ proto void debug_print_backtrace(void) */
|
||||
ZEND_FUNCTION(debug_print_backtrace)
|
||||
{
|
||||
zend_execute_data *ptr;
|
||||
zend_execute_data *ptr, *skip;
|
||||
int lineno;
|
||||
char *function_name;
|
||||
char *filename;
|
||||
@@ -1575,6 +1573,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
args -= *(ulong*)args;
|
||||
frames_on_stack++;
|
||||
|
||||
/* skip args from incomplete frames */
|
||||
while (((args-1) > EG(argument_stack).elements) && *(args-1)) {
|
||||
args--;
|
||||
}
|
||||
|
||||
if ((args-1) == EG(argument_stack).elements) {
|
||||
arg_stack_consistent = 1;
|
||||
break;
|
||||
@@ -1588,14 +1591,35 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
cur_arg_pos -= 2;
|
||||
frames_on_stack--;
|
||||
|
||||
if (arg_stack_consistent) {
|
||||
/* skip args from incomplete frames */
|
||||
while (((cur_arg_pos-1) > EG(argument_stack).elements) && *(cur_arg_pos-1)) {
|
||||
cur_arg_pos--;
|
||||
}
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
while (ptr) {
|
||||
class_name = call_type = NULL;
|
||||
char *free_class_name = NULL;
|
||||
|
||||
class_name = call_type = NULL;
|
||||
arg_array = NULL;
|
||||
if (ptr->op_array) {
|
||||
filename = ptr->op_array->filename;
|
||||
lineno = ptr->opline->lineno;
|
||||
|
||||
skip = ptr;
|
||||
/* skip internal handler */
|
||||
if (!skip->op_array &&
|
||||
skip->prev_execute_data &&
|
||||
skip->prev_execute_data->opline &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
|
||||
skip = skip->prev_execute_data;
|
||||
}
|
||||
|
||||
if (skip->op_array) {
|
||||
filename = skip->op_array->filename;
|
||||
lineno = skip->opline->lineno;
|
||||
} else {
|
||||
filename = NULL;
|
||||
lineno = 0;
|
||||
@@ -1605,7 +1629,18 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
|
||||
if (function_name) {
|
||||
if (ptr->object) {
|
||||
class_name = Z_OBJCE(*ptr->object)->name;
|
||||
if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
} else {
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
|
||||
if(!dup) {
|
||||
free_class_name = class_name;
|
||||
}
|
||||
}
|
||||
|
||||
call_type = "->";
|
||||
} else if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
@@ -1624,6 +1659,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
/* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
|
||||
zend_bool build_filename_arg = 1;
|
||||
|
||||
if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
|
||||
/* can happen when calling eval from a custom sapi */
|
||||
function_name = "unknown";
|
||||
build_filename_arg = 0;
|
||||
} else
|
||||
switch (ptr->opline->op2.u.constant.value.lval) {
|
||||
case ZEND_EVAL:
|
||||
function_name = "eval";
|
||||
@@ -1668,8 +1708,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
}
|
||||
zend_printf(") called at [%s:%d]\n", filename, lineno);
|
||||
include_filename = filename;
|
||||
ptr = ptr->prev_execute_data;
|
||||
ptr = skip->prev_execute_data;
|
||||
++indent;
|
||||
if (free_class_name) {
|
||||
efree(free_class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1677,12 +1720,11 @@ ZEND_FUNCTION(debug_print_backtrace)
|
||||
|
||||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRMLS_DC)
|
||||
{
|
||||
zend_execute_data *ptr;
|
||||
zend_execute_data *ptr, *skip;
|
||||
int lineno;
|
||||
char *function_name;
|
||||
char *filename;
|
||||
char *class_name;
|
||||
char *call_type;
|
||||
char *include_filename = NULL;
|
||||
zval *stack_frame;
|
||||
void **cur_arg_pos = EG(argument_stack).top_element;
|
||||
@@ -1697,6 +1739,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
args -= *(ulong*)args;
|
||||
frames_on_stack++;
|
||||
|
||||
/* skip args from incomplete frames */
|
||||
while (((args-1) > EG(argument_stack).elements) && *(args-1)) {
|
||||
args--;
|
||||
}
|
||||
|
||||
if ((args-1) == EG(argument_stack).elements) {
|
||||
arg_stack_consistent = 1;
|
||||
break;
|
||||
@@ -1705,12 +1752,24 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
|
||||
ptr = EG(current_execute_data);
|
||||
|
||||
/* skip "new Exception()" */
|
||||
if ((skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
|
||||
ptr = ptr->prev_execute_data;
|
||||
}
|
||||
|
||||
/* skip debug_backtrace() */
|
||||
if (skip_last--) {
|
||||
int arg_count = *((ulong*)(cur_arg_pos - 2));
|
||||
cur_arg_pos -= (arg_count + 2);
|
||||
frames_on_stack--;
|
||||
ptr = ptr->prev_execute_data;
|
||||
|
||||
if (arg_stack_consistent) {
|
||||
/* skip args from incomplete frames */
|
||||
while (((cur_arg_pos-1) > EG(argument_stack).elements) && *(cur_arg_pos-1)) {
|
||||
cur_arg_pos--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_init(return_value);
|
||||
@@ -1719,9 +1778,20 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
MAKE_STD_ZVAL(stack_frame);
|
||||
array_init(stack_frame);
|
||||
|
||||
if (ptr->op_array) {
|
||||
filename = ptr->op_array->filename;
|
||||
lineno = ptr->opline->lineno;
|
||||
skip = ptr;
|
||||
/* skip internal handler */
|
||||
if (!skip->op_array &&
|
||||
skip->prev_execute_data &&
|
||||
skip->prev_execute_data->opline &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_DO_FCALL_BY_NAME &&
|
||||
skip->prev_execute_data->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
|
||||
skip = skip->prev_execute_data;
|
||||
}
|
||||
|
||||
if (skip->op_array) {
|
||||
filename = skip->op_array->filename;
|
||||
lineno = skip->opline->lineno;
|
||||
add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
|
||||
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
|
||||
|
||||
@@ -1738,19 +1808,20 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
|
||||
|
||||
if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
|
||||
class_name = Z_OBJCE(*ptr->object)->name;
|
||||
call_type = "->";
|
||||
if (ptr->function_state.function->common.scope) {
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
|
||||
} else {
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, dup);
|
||||
|
||||
}
|
||||
add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1);
|
||||
} else if (ptr->function_state.function->common.scope) {
|
||||
class_name = ptr->function_state.function->common.scope->name;
|
||||
call_type = "::";
|
||||
} else {
|
||||
class_name = NULL;
|
||||
call_type = NULL;
|
||||
}
|
||||
|
||||
if (class_name) {
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, 1);
|
||||
add_assoc_string_ex(stack_frame, "type", sizeof("type"), call_type, 1);
|
||||
add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
|
||||
add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
|
||||
}
|
||||
|
||||
if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) {
|
||||
@@ -1763,7 +1834,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
/* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
|
||||
zend_bool build_filename_arg = 1;
|
||||
|
||||
if (!ptr->opline) {
|
||||
if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) {
|
||||
/* can happen when calling eval from a custom sapi */
|
||||
function_name = "unknown";
|
||||
build_filename_arg = 0;
|
||||
@@ -1814,7 +1885,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
|
||||
|
||||
include_filename = filename;
|
||||
|
||||
ptr = ptr->prev_execute_data;
|
||||
ptr = skip->prev_execute_data;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1893,7 +1964,6 @@ ZEND_FUNCTION(get_extension_funcs)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
|
||||
+137
-64
@@ -418,6 +418,9 @@ void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body
|
||||
}
|
||||
|
||||
if (modifiers->u.constant.value.lval & ZEND_ACC_ABSTRACT) {
|
||||
if(modifiers->u.constant.value.lval & ZEND_ACC_PRIVATE) {
|
||||
zend_error(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", method_type, CG(active_class_entry)->name, function_name->u.constant.value.str.val);
|
||||
}
|
||||
if (body->u.constant.value.lval == ZEND_ACC_ABSTRACT) {
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
@@ -483,6 +486,12 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
static inline zend_bool zend_is_function_or_method_call(znode *variable)
|
||||
{
|
||||
zend_uint type = variable->u.EA.type;
|
||||
|
||||
return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL));
|
||||
}
|
||||
|
||||
void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
|
||||
{
|
||||
@@ -494,6 +503,11 @@ void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
|
||||
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
|
||||
}
|
||||
if (zend_is_function_or_method_call(rvar)) {
|
||||
opline->extended_value = ZEND_RETURNS_FUNCTION;
|
||||
} else {
|
||||
opline->extended_value = 0;
|
||||
}
|
||||
if (result) {
|
||||
opline->result.op_type = IS_VAR;
|
||||
opline->result.u.EA.type = 0;
|
||||
@@ -717,13 +731,6 @@ void zend_check_writable_variable(znode *variable)
|
||||
}
|
||||
}
|
||||
|
||||
static inline zend_bool zend_is_function_or_method_call(znode *variable)
|
||||
{
|
||||
zend_uint type = variable->u.EA.type;
|
||||
|
||||
return ((type & ZEND_PARSED_METHOD_CALL) || (type == ZEND_PARSED_FUNCTION_CALL));
|
||||
}
|
||||
|
||||
void zend_do_begin_variable_parse(TSRMLS_D)
|
||||
{
|
||||
zend_llist fetch_list;
|
||||
@@ -738,51 +745,53 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
|
||||
zend_llist *fetch_list_ptr;
|
||||
zend_llist_element *le;
|
||||
zend_op *opline, *opline_ptr=NULL;
|
||||
int num_of_created_opcodes = 0;
|
||||
|
||||
zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
|
||||
|
||||
le = fetch_list_ptr->head;
|
||||
|
||||
while (le) {
|
||||
if (le) {
|
||||
opline_ptr = (zend_op *)le->data;
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
memcpy(opline, opline_ptr, sizeof(zend_op));
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
opline->opcode -= 3;
|
||||
break;
|
||||
case BP_VAR_W:
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
opline->opcode += 3;
|
||||
break;
|
||||
case BP_VAR_IS:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
opline->opcode += 6; /* 3+3 */
|
||||
break;
|
||||
case BP_VAR_FUNC_ARG:
|
||||
opline->opcode += 9; /* 3+3+3 */
|
||||
opline->extended_value = arg_offset;
|
||||
break;
|
||||
case BP_VAR_UNSET:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting");
|
||||
}
|
||||
opline->opcode += 12; /* 3+3+3+3 */
|
||||
break;
|
||||
if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) {
|
||||
CG(active_op_array)->uses_this = 1;
|
||||
}
|
||||
le = le->next;
|
||||
num_of_created_opcodes++;
|
||||
}
|
||||
|
||||
if (num_of_created_opcodes == 1 && opline_is_fetch_this(opline_ptr TSRMLS_CC)) {
|
||||
CG(active_op_array)->uses_this = 1;
|
||||
while (1) {
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
memcpy(opline, opline_ptr, sizeof(zend_op));
|
||||
switch (type) {
|
||||
case BP_VAR_R:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
opline->opcode -= 3;
|
||||
break;
|
||||
case BP_VAR_W:
|
||||
break;
|
||||
case BP_VAR_RW:
|
||||
opline->opcode += 3;
|
||||
break;
|
||||
case BP_VAR_IS:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
opline->opcode += 6; /* 3+3 */
|
||||
break;
|
||||
case BP_VAR_FUNC_ARG:
|
||||
opline->opcode += 9; /* 3+3+3 */
|
||||
opline->extended_value = arg_offset;
|
||||
break;
|
||||
case BP_VAR_UNSET:
|
||||
if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use [] for unsetting");
|
||||
}
|
||||
opline->opcode += 12; /* 3+3+3+3 */
|
||||
break;
|
||||
}
|
||||
le = le->next;
|
||||
if (le == NULL) break;
|
||||
opline_ptr = (zend_op *)le->data;
|
||||
}
|
||||
}
|
||||
|
||||
zend_llist_destroy(fetch_list_ptr);
|
||||
@@ -894,7 +903,8 @@ void zend_do_free(znode *op1 TSRMLS_DC)
|
||||
* Find JMP_NO_CTOR, mark the preceding ASSIGN and the
|
||||
* proceeding INIT_FCALL_BY_NAME as unused
|
||||
*/
|
||||
if (opline->opcode == ZEND_JMP_NO_CTOR) {
|
||||
if (opline->opcode == ZEND_JMP_NO_CTOR &&
|
||||
opline->op1.u.var == op1->u.var) {
|
||||
opline->op1.u.EA.type |= EXT_TYPE_UNUSED;
|
||||
(opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
|
||||
(opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;
|
||||
@@ -965,7 +975,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
op_array.fn_flags = fn_flags;
|
||||
op_array.pass_rest_by_reference = 0;
|
||||
|
||||
op_array.scope = CG(active_class_entry);
|
||||
op_array.scope = is_method?CG(active_class_entry):NULL;
|
||||
op_array.prototype = NULL;
|
||||
|
||||
op_array.line_start = zend_get_compiled_lineno(TSRMLS_C);
|
||||
@@ -1074,9 +1084,10 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
}
|
||||
|
||||
if (CG(doc_comment)) {
|
||||
CG(active_op_array)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len));
|
||||
CG(active_op_array)->doc_comment = CG(doc_comment);
|
||||
CG(active_op_array)->doc_comment_len = CG(doc_comment_len);
|
||||
RESET_DOC_COMMENT();
|
||||
CG(doc_comment) = NULL;
|
||||
CG(doc_comment_len) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,6 +1297,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC)
|
||||
opline->op2 = *class_name;
|
||||
}
|
||||
opline->result.u.var = get_temporary_variable(CG(active_op_array));
|
||||
opline->result.u.EA.type = opline->extended_value;
|
||||
opline->result.op_type = IS_CONST; /* FIXME: Hack so that INIT_FCALL_BY_NAME still knows this is a class */
|
||||
*result = opline->result;
|
||||
}
|
||||
@@ -1370,6 +1382,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
|
||||
int original_op=op;
|
||||
zend_function **function_ptr_ptr, *function_ptr;
|
||||
int send_by_reference;
|
||||
int send_function = 0;
|
||||
|
||||
zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
|
||||
function_ptr = *function_ptr_ptr;
|
||||
@@ -1394,6 +1407,7 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
|
||||
if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
|
||||
/* Method call */
|
||||
op = ZEND_SEND_VAR_NO_REF;
|
||||
send_function = ZEND_ARG_SEND_FUNCTION;
|
||||
} else if (op == ZEND_SEND_VAL && param->op_type == IS_VAR) {
|
||||
op = ZEND_SEND_VAR_NO_REF;
|
||||
}
|
||||
@@ -1432,9 +1446,9 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC)
|
||||
|
||||
if (op == ZEND_SEND_VAR_NO_REF) {
|
||||
if (function_ptr) {
|
||||
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference;
|
||||
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND | send_by_reference | send_function;
|
||||
} else {
|
||||
opline->extended_value = 0;
|
||||
opline->extended_value = send_function;
|
||||
}
|
||||
} else {
|
||||
if (function_ptr) {
|
||||
@@ -1455,7 +1469,7 @@ static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC)
|
||||
zend_op *opline;
|
||||
|
||||
if (switch_entry->cond.op_type != IS_VAR && switch_entry->cond.op_type != IS_TMP_VAR) {
|
||||
return 0;
|
||||
return (switch_entry->cond.op_type == IS_UNUSED);
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
@@ -1854,9 +1868,18 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
zend_property_info *child_info;
|
||||
zend_class_entry *parent_ce = ce->parent;
|
||||
|
||||
if (parent_info->flags & ZEND_ACC_PRIVATE) {
|
||||
if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
|
||||
if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
|
||||
child_info->flags |= ZEND_ACC_CHANGED;
|
||||
} else {
|
||||
zend_hash_quick_update(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info);
|
||||
if(ce->type & ZEND_INTERNAL_CLASS) {
|
||||
zend_duplicate_property_info_internal(child_info);
|
||||
} else {
|
||||
zend_duplicate_property_info(child_info);
|
||||
}
|
||||
child_info->flags &= ~ZEND_ACC_PRIVATE; /* it's not private anymore */
|
||||
child_info->flags |= ZEND_ACC_SHADOW; /* but it's a shadow of private */
|
||||
}
|
||||
return 0; /* don't copy access information to child */
|
||||
}
|
||||
@@ -1868,6 +1891,11 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
(child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->arKey);
|
||||
|
||||
}
|
||||
|
||||
if(parent_info->flags & ZEND_ACC_CHANGED) {
|
||||
child_info->flags |= ZEND_ACC_CHANGED;
|
||||
}
|
||||
|
||||
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||
} else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) {
|
||||
@@ -2167,6 +2195,19 @@ void zend_do_early_binding(TSRMLS_D)
|
||||
if (do_bind_inherited_class(opline, CG(class_table), *pce, 1 TSRMLS_CC) == NULL) {
|
||||
return;
|
||||
}
|
||||
/* clear unnecessary ZEND_FETCH_CLASS opcode */
|
||||
if (opline > CG(active_op_array)->opcodes &&
|
||||
(opline-1)->opcode == ZEND_FETCH_CLASS) {
|
||||
zend_op *fetch_class_opline = opline-1;
|
||||
|
||||
zval_dtor(&fetch_class_opline->op2.u.constant);
|
||||
fetch_class_opline->opcode = ZEND_NOP;
|
||||
memset(&fetch_class_opline->op1, 0, sizeof(znode));
|
||||
memset(&fetch_class_opline->op2, 0, sizeof(znode));
|
||||
SET_UNUSED(fetch_class_opline->op1);
|
||||
SET_UNUSED(fetch_class_opline->op2);
|
||||
SET_UNUSED(fetch_class_opline->result);
|
||||
}
|
||||
} else {
|
||||
/* We currently don't early-bind classes that implement interfaces */
|
||||
return;
|
||||
@@ -2496,10 +2537,20 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
|
||||
|
||||
zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC);
|
||||
new_class_entry->filename = zend_get_compiled_filename(TSRMLS_C);
|
||||
new_class_entry->line_start = zend_get_compiled_lineno(TSRMLS_C);
|
||||
new_class_entry->ce_flags |= class_token->u.constant.value.lval;
|
||||
new_class_entry->line_start = class_token->u.opline_num;
|
||||
new_class_entry->ce_flags |= class_token->u.EA.type;
|
||||
|
||||
if (parent_class_name && parent_class_name->op_type != IS_UNUSED) {
|
||||
switch (parent_class_name->u.EA.type) {
|
||||
case ZEND_FETCH_CLASS_SELF:
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'self' as class name as it is reserved");
|
||||
break;
|
||||
case ZEND_FETCH_CLASS_PARENT:
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as class name as it is reserved");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
doing_inheritance = 1;
|
||||
}
|
||||
|
||||
@@ -2529,9 +2580,10 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
|
||||
CG(implementing_class) = opline->result;
|
||||
|
||||
if (CG(doc_comment)) {
|
||||
CG(active_class_entry)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len));
|
||||
CG(active_class_entry)->doc_comment = CG(doc_comment);
|
||||
CG(active_class_entry)->doc_comment_len = CG(doc_comment_len);
|
||||
RESET_DOC_COMMENT();
|
||||
CG(doc_comment) = NULL;
|
||||
CG(doc_comment_len) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2575,7 +2627,8 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
|
||||
|
||||
/* Inherit interfaces */
|
||||
if (ce->num_interfaces > 0) {
|
||||
ce->interfaces = (zend_class_entry **) erealloc(ce->interfaces, sizeof(zend_class_entry *)*ce->num_interfaces);
|
||||
ce->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *)*ce->num_interfaces);
|
||||
memset(ce->interfaces, 0, sizeof(zend_class_entry *)*ce->num_interfaces);
|
||||
}
|
||||
if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))
|
||||
&& ((parent_token->op_type != IS_UNUSED) || (ce->num_interfaces > 0))) {
|
||||
@@ -2590,8 +2643,26 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
|
||||
|
||||
void zend_do_implements_interface(znode *interface_znode TSRMLS_DC)
|
||||
{
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
zend_op *opline;
|
||||
|
||||
switch (interface_znode->u.EA.type) {
|
||||
case ZEND_FETCH_CLASS_SELF:
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'self' as interface name as it is reserved");
|
||||
break;
|
||||
case ZEND_FETCH_CLASS_PARENT:
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use 'parent' as interface name as it is reserved");
|
||||
break;
|
||||
default:
|
||||
if (CG(active_op_array)->last > 0) {
|
||||
opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
|
||||
if (opline->opcode == ZEND_FETCH_CLASS) {
|
||||
opline->extended_value = ZEND_FETCH_CLASS_INTERFACE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
opline->opcode = ZEND_ADD_INTERFACE;
|
||||
opline->op1 = CG(implementing_class);
|
||||
opline->op2 = *interface_znode;
|
||||
@@ -2958,9 +3029,16 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
|
||||
zend_symtable_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
|
||||
zval_dtor(&offset->u.constant);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_symtable_update(result->u.constant.value.ht, "", 1, &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_LONG:
|
||||
case IS_BOOL:
|
||||
zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
case IS_DOUBLE:
|
||||
zend_hash_index_update(result->u.constant.value.ht, (long)offset->u.constant.value.dval, &element, sizeof(zval *), NULL);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
|
||||
@@ -3013,7 +3091,6 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
|
||||
zend_llist_element *dimension;
|
||||
zend_op *opline;
|
||||
znode last_container;
|
||||
int opcode_index;
|
||||
int last_op_number;
|
||||
zend_op *last_op;
|
||||
|
||||
@@ -3055,14 +3132,10 @@ void zend_do_list_end(znode *result, znode *expr TSRMLS_DC)
|
||||
((list_llist_element *) le->data)->value = last_container;
|
||||
zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
|
||||
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
|
||||
opcode_index = - 1;
|
||||
last_op_number = get_next_op_number(CG(active_op_array))-1;
|
||||
last_op = &CG(active_op_array)->opcodes[last_op_number];
|
||||
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
|
||||
opcode_index = - 2;
|
||||
}
|
||||
zend_do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value TSRMLS_CC);
|
||||
CG(active_op_array)->opcodes[CG(active_op_array)->last + opcode_index].result.u.EA.type |= EXT_TYPE_UNUSED;
|
||||
zend_do_free(result TSRMLS_CC);
|
||||
le = le->next;
|
||||
}
|
||||
zend_llist_destroy(&CG(dimension_llist));
|
||||
|
||||
+12
-4
@@ -41,10 +41,13 @@
|
||||
#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); }
|
||||
#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); }
|
||||
|
||||
#define RESET_DOC_COMMENT() \
|
||||
{ \
|
||||
CG(doc_comment) = NULL; \
|
||||
CG(doc_comment_len) = 0; \
|
||||
#define RESET_DOC_COMMENT() \
|
||||
{ \
|
||||
if (CG(doc_comment)) { \
|
||||
efree(CG(doc_comment)); \
|
||||
CG(doc_comment) = NULL; \
|
||||
} \
|
||||
CG(doc_comment_len) = 0; \
|
||||
}
|
||||
|
||||
typedef struct _zend_op_array zend_op_array;
|
||||
@@ -131,6 +134,9 @@ typedef struct _zend_try_catch_element {
|
||||
/* method flag (bc only), any method that has this flag can be used statically and non statically. */
|
||||
#define ZEND_ACC_ALLOW_STATIC 0x10000
|
||||
|
||||
/* shadow of parent's private method/property */
|
||||
#define ZEND_ACC_SHADOW 0x20000
|
||||
|
||||
char *zend_visibility_string(zend_uint fn_flags);
|
||||
|
||||
|
||||
@@ -738,6 +744,7 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
#define ZEND_FETCH_CLASS_MAIN 3
|
||||
#define ZEND_FETCH_CLASS_GLOBAL 4
|
||||
#define ZEND_FETCH_CLASS_AUTO 5
|
||||
#define ZEND_FETCH_CLASS_INTERFACE 6
|
||||
|
||||
|
||||
/* variable parsing type (compile-time) */
|
||||
@@ -798,6 +805,7 @@ int zendlex(znode *zendlval TSRMLS_DC);
|
||||
|
||||
#define ZEND_ARG_SEND_BY_REF (1<<0)
|
||||
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
|
||||
#define ZEND_ARG_SEND_FUNCTION (1<<2)
|
||||
|
||||
#define AI_USE_PTR(ai) \
|
||||
if ((ai).ptr_ptr) { \
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#ifndef ZEND_CONFIG_W32_H
|
||||
#define ZEND_CONFIG_W32_H
|
||||
|
||||
#define USE_ZEND_ALLOC 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
|
||||
+11
-1
@@ -298,10 +298,20 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k
|
||||
TRACE_APPEND_STR("Array, ");
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
TRACE_APPEND_STR("Object(");
|
||||
TRACE_APPEND_STRL(Z_OBJCE_PP(arg)->name, strlen(Z_OBJCE_PP(arg)->name));
|
||||
|
||||
dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
TRACE_APPEND_STRL(class_name, class_name_len);
|
||||
if(!dup) {
|
||||
efree(class_name);
|
||||
}
|
||||
|
||||
TRACE_APPEND_STR("), ");
|
||||
break;
|
||||
}
|
||||
|
||||
+259
-154
@@ -54,6 +54,17 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_
|
||||
|
||||
#define TEMP_VAR_STACK_LIMIT 2000
|
||||
|
||||
#define MAKE_REAL_ZVAL_PTR(val) \
|
||||
do { \
|
||||
zval *_tmp; \
|
||||
ALLOC_ZVAL(_tmp); \
|
||||
_tmp->value = (val)->value; \
|
||||
_tmp->type = (val)->type; \
|
||||
_tmp->refcount = 1; \
|
||||
_tmp->is_ref = 0; \
|
||||
val = _tmp; \
|
||||
} while (0)
|
||||
|
||||
/* former zend_execute_locks.h */
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
{
|
||||
@@ -154,22 +165,9 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
|
||||
static inline void zend_fetch_property_address_inner(zval *object, znode *op2, znode *result, temp_variable *Ts, int type TSRMLS_DC)
|
||||
{
|
||||
zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval tmp;
|
||||
|
||||
|
||||
switch (op2->op_type) {
|
||||
case IS_CONST:
|
||||
/* already a constant string */
|
||||
break;
|
||||
case IS_VAR:
|
||||
tmp = *prop_ptr;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
prop_ptr = &tmp;
|
||||
break;
|
||||
case IS_TMP_VAR:
|
||||
convert_to_string(prop_ptr);
|
||||
break;
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(prop_ptr);
|
||||
}
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
@@ -192,10 +190,9 @@ static inline void zend_fetch_property_address_inner(zval *object, znode *op2, z
|
||||
T(result->u.var).var.ptr_ptr = &EG(error_zval_ptr);
|
||||
}
|
||||
|
||||
if (prop_ptr == &tmp) {
|
||||
zval_dtor(prop_ptr);
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&prop_ptr);
|
||||
}
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +255,6 @@ void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, z
|
||||
value_ptr->refcount = 1;
|
||||
value_ptr->is_ref = 1;
|
||||
}
|
||||
|
||||
*variable_ptr_ptr = value_ptr;
|
||||
value_ptr->refcount++;
|
||||
} else if (!variable_ptr->is_ref) {
|
||||
@@ -393,15 +389,27 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
|
||||
/* separate our value if necessary */
|
||||
if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
|
||||
zval *orig_value = value;
|
||||
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
ALLOC_ZVAL(value);
|
||||
*value = *orig_value;
|
||||
value->is_ref = 0;
|
||||
value->refcount = 0;
|
||||
|
||||
dup = zend_get_object_classname(orig_value, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) {
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(orig_value)->name);
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name);
|
||||
}
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(orig_value)->name);
|
||||
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
|
||||
|
||||
if(!dup) {
|
||||
efree(class_name);
|
||||
}
|
||||
|
||||
value->value.obj = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC);
|
||||
} else if (value_op->op_type == IS_TMP_VAR) {
|
||||
zval *orig_value = value;
|
||||
@@ -423,40 +431,29 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
|
||||
|
||||
value->refcount++;
|
||||
if (opcode == ZEND_ASSIGN_OBJ) {
|
||||
zval tmp;
|
||||
|
||||
switch (op2->op_type) {
|
||||
case IS_CONST:
|
||||
/* already a constant string */
|
||||
break;
|
||||
case IS_VAR:
|
||||
tmp = *property_name;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
property_name = &tmp;
|
||||
break;
|
||||
case IS_TMP_VAR:
|
||||
convert_to_string(property_name);
|
||||
break;
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(property_name);
|
||||
}
|
||||
Z_OBJ_HT_P(object)->write_property(object, property_name, value TSRMLS_CC);
|
||||
if (property_name == &tmp) {
|
||||
zval_dtor(property_name);
|
||||
}
|
||||
} else {
|
||||
/* Note: property_name in this case is really the array index! */
|
||||
if (!Z_OBJ_HT_P(object)->write_dimension) {
|
||||
zend_error(E_ERROR, "Cannot use object as array");
|
||||
}
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(property_name);
|
||||
}
|
||||
Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
|
||||
}
|
||||
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
if (result) {
|
||||
T(result->u.var).var.ptr = value;
|
||||
T(result->u.var).var.ptr_ptr = &T(result->u.var).var.ptr; /* this is so that we could use it in FETCH_DIM_R, etc. - see bug #27876 */
|
||||
SELECTIVE_PZVAL_LOCK(value, result);
|
||||
}
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&property_name);
|
||||
}
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
|
||||
@@ -566,40 +563,60 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
|
||||
}
|
||||
|
||||
if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) {
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(value)->name);
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name);
|
||||
} else if (PZVAL_IS_REF(variable_ptr)) {
|
||||
if (variable_ptr != value) {
|
||||
if (variable_ptr != value) {
|
||||
zend_uint refcount = variable_ptr->refcount;
|
||||
zval garbage;
|
||||
|
||||
|
||||
if (type != IS_TMP_VAR) {
|
||||
value->refcount++;
|
||||
}
|
||||
|
||||
garbage = *variable_ptr;
|
||||
*variable_ptr = *value;
|
||||
variable_ptr->refcount = refcount;
|
||||
variable_ptr->is_ref = 1;
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(value)->name);
|
||||
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
|
||||
|
||||
variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
|
||||
|
||||
if (type != IS_TMP_VAR) {
|
||||
value->refcount--;
|
||||
}
|
||||
|
||||
zendi_zval_dtor(garbage);
|
||||
}
|
||||
} else {
|
||||
variable_ptr->refcount--;
|
||||
if (variable_ptr->refcount == 0) {
|
||||
zendi_zval_dtor(*variable_ptr);
|
||||
} else {
|
||||
ALLOC_ZVAL(variable_ptr);
|
||||
*variable_ptr_ptr = variable_ptr;
|
||||
if (variable_ptr != value) {
|
||||
value->refcount++;
|
||||
variable_ptr->refcount--;
|
||||
if (variable_ptr->refcount == 0) {
|
||||
zendi_zval_dtor(*variable_ptr);
|
||||
} else {
|
||||
ALLOC_ZVAL(variable_ptr);
|
||||
*variable_ptr_ptr = variable_ptr;
|
||||
}
|
||||
*variable_ptr = *value;
|
||||
INIT_PZVAL(variable_ptr);
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
|
||||
variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
|
||||
zval_ptr_dtor(&value);
|
||||
}
|
||||
*variable_ptr = *value;
|
||||
INIT_PZVAL(variable_ptr);
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(value)->name);
|
||||
variable_ptr->value.obj = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC);
|
||||
}
|
||||
|
||||
if(!dup) {
|
||||
efree(class_name);
|
||||
}
|
||||
|
||||
} else if (PZVAL_IS_REF(variable_ptr)) {
|
||||
if (variable_ptr!=value) {
|
||||
zend_uint refcount = variable_ptr->refcount;
|
||||
@@ -945,7 +962,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
|
||||
new_zval->refcount++;
|
||||
if (zend_hash_next_index_insert(container->value.ht, &new_zval, sizeof(zval *), (void **) retval) == FAILURE) {
|
||||
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
|
||||
*retval = &EG(uninitialized_zval_ptr);
|
||||
*retval = &EG(error_zval_ptr);
|
||||
new_zval->refcount--;
|
||||
}
|
||||
} else {
|
||||
@@ -1003,8 +1020,12 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
|
||||
zend_error(E_ERROR, "Cannot use object as array");
|
||||
} else {
|
||||
zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval *overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
|
||||
zval *overloaded_result;
|
||||
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(dim);
|
||||
}
|
||||
overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
|
||||
if (overloaded_result) {
|
||||
switch (type) {
|
||||
case BP_VAR_RW:
|
||||
@@ -1021,8 +1042,10 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
|
||||
*retval = &EG(error_zval_ptr);
|
||||
}
|
||||
AI_USE_PTR(T(result->u.var).var);
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
SELECTIVE_PZVAL_LOCK(**retval, result);
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&dim);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
@@ -1140,41 +1163,29 @@ static void zend_fetch_property_address_read(znode *result, znode *op1, znode *o
|
||||
} else {
|
||||
*retval = EG(error_zval_ptr);
|
||||
}
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
} else {
|
||||
zval *offset;
|
||||
zval tmp;
|
||||
|
||||
offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
switch (op2->op_type) {
|
||||
case IS_CONST:
|
||||
/* already a constant string */
|
||||
break;
|
||||
case IS_VAR:
|
||||
tmp = *offset;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
offset = &tmp;
|
||||
break;
|
||||
case IS_TMP_VAR:
|
||||
convert_to_string(offset);
|
||||
break;
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
|
||||
/* here we are sure we are dealing with an object */
|
||||
*retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC);
|
||||
if (offset == &tmp) {
|
||||
zval_dtor(offset);
|
||||
}
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
|
||||
if (RETURN_VALUE_UNUSED(result) && ((*retval)->refcount == 0)) {
|
||||
zval_dtor(*retval);
|
||||
FREE_ZVAL(*retval);
|
||||
return; /* no need for locking */
|
||||
} else {
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
}
|
||||
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&offset);
|
||||
}
|
||||
}
|
||||
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
}
|
||||
|
||||
static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
|
||||
@@ -1197,6 +1208,10 @@ static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp
|
||||
return;
|
||||
}
|
||||
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
|
||||
/* here we are sure we are dealing with an object */
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
@@ -1232,7 +1247,9 @@ static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&property);
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, temp_variable * Ts, int (*incdec_op)(zval *) TSRMLS_DC)
|
||||
@@ -1253,6 +1270,10 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
return;
|
||||
}
|
||||
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
|
||||
/* here we are sure we are dealing with an object */
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
@@ -1271,6 +1292,7 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
|
||||
if (!have_get_ptr) {
|
||||
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_RW TSRMLS_CC);
|
||||
zval *z_copy;
|
||||
|
||||
if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
|
||||
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
|
||||
@@ -1283,13 +1305,22 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
}
|
||||
*retval = *z;
|
||||
zendi_zval_copy_ctor(*retval);
|
||||
incdec_op(z);
|
||||
ALLOC_ZVAL(z_copy);
|
||||
*z_copy = *z;
|
||||
zendi_zval_copy_ctor(*z_copy);
|
||||
INIT_PZVAL(z_copy);
|
||||
incdec_op(z_copy);
|
||||
z->refcount++;
|
||||
Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
|
||||
Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC);
|
||||
zval_ptr_dtor(&z_copy);
|
||||
/* this would destroy z if it was returned with refcount == 0 and undo
|
||||
recount++ above otherwise */
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&property);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1328,7 +1359,7 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
|
||||
|
||||
#define SET_OPCODE(new_op) \
|
||||
CHECK_SYMBOL_TABLES() \
|
||||
EX(opline) = new_op;
|
||||
EX(opline) = new_op; \
|
||||
|
||||
#define INC_OPCODE() \
|
||||
if (!EG(exception)) { \
|
||||
@@ -1638,7 +1669,6 @@ static inline int zend_binary_assign_op_obj_helper(int (*binary_op)(zval *result
|
||||
zval *property = get_zval_ptr(&opline->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
|
||||
zval *free_value;
|
||||
zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_value, BP_VAR_R);
|
||||
zval tmp;
|
||||
znode *result = &opline->result;
|
||||
zval **retval = &EX_T(result->u.var).var.ptr;
|
||||
int have_get_ptr = 0;
|
||||
@@ -1657,19 +1687,8 @@ static inline int zend_binary_assign_op_obj_helper(int (*binary_op)(zval *result
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
} else {
|
||||
/* here we are sure we are dealing with an object */
|
||||
switch (opline->op2.op_type) {
|
||||
case IS_CONST:
|
||||
/* already a constant string */
|
||||
break;
|
||||
case IS_VAR:
|
||||
tmp = *property;
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
property = &tmp;
|
||||
break;
|
||||
case IS_TMP_VAR:
|
||||
convert_to_string(property);
|
||||
break;
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(property);
|
||||
}
|
||||
|
||||
/* here property is a string */
|
||||
@@ -1722,11 +1741,9 @@ static inline int zend_binary_assign_op_obj_helper(int (*binary_op)(zval *result
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
|
||||
if (property == &tmp) {
|
||||
zval_dtor(property);
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&property);
|
||||
}
|
||||
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
FREE_OP(Ts, value, free_value);
|
||||
}
|
||||
|
||||
@@ -2114,6 +2131,9 @@ int zend_fetch_dim_func_arg_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
/* Behave like FETCH_DIM_W */
|
||||
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
|
||||
} else {
|
||||
if (opline->op2.op_type == IS_UNUSED) {
|
||||
zend_error(E_ERROR, "Cannot use [] for reading");
|
||||
}
|
||||
/* Behave like FETCH_DIM_R, except for locking used for list() */
|
||||
zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
|
||||
AI_USE_PTR(EX_T(opline->result.u.var).var);
|
||||
@@ -2246,7 +2266,7 @@ int zend_assign_dim_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
zend_fetch_dimension_address(&op_data->op2, &opline->op1, &opline->op2, EX(Ts), BP_VAR_W TSRMLS_CC);
|
||||
|
||||
value = get_zval_ptr(&op_data->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (EG(free_op1)?IS_TMP_VAR:opline->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
zend_assign_to_variable(&opline->result, &op_data->op2, &op_data->op1, value, (EG(free_op1)?IS_TMP_VAR:op_data->op1.op_type), EX(Ts) TSRMLS_CC);
|
||||
}
|
||||
/* assign_dim has two opcodes! */
|
||||
INC_OPCODE();
|
||||
@@ -2270,6 +2290,19 @@ int zend_assign_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zval **value_ptr_ptr = get_zval_ptr_ptr(&opline->op2, EX(Ts), BP_VAR_W);
|
||||
|
||||
if (opline->op2.op_type == IS_VAR &&
|
||||
value_ptr_ptr &&
|
||||
!(*value_ptr_ptr)->is_ref &&
|
||||
opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
!EX_T(opline->op2.u.var).var.fcall_returned_reference) {
|
||||
PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
zend_error(E_STRICT, "Only variables should be assigned by reference");
|
||||
return zend_assign_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
if (opline->op1.op_type == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) {
|
||||
zend_error(E_ERROR, "Cannot assign by reference to overloaded object");
|
||||
}
|
||||
|
||||
zend_assign_to_variable_reference(&opline->result, get_zval_ptr_ptr(&opline->op1, EX(Ts), BP_VAR_W), value_ptr_ptr, EX(Ts) TSRMLS_CC);
|
||||
|
||||
NEXT_OPCODE();
|
||||
@@ -2454,7 +2487,7 @@ int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
|
||||
if (opline->op2.op_type == IS_UNUSED) {
|
||||
EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, ZEND_FETCH_CLASS_AUTO, opline->extended_value TSRMLS_CC);
|
||||
EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -2465,7 +2498,7 @@ int zend_fetch_class_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
|
||||
break;
|
||||
case IS_STRING:
|
||||
EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);
|
||||
EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
|
||||
break;
|
||||
default:
|
||||
zend_error(E_ERROR, "Class name must be a valid object or a string");
|
||||
@@ -2806,9 +2839,11 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
|
||||
EG(This)->refcount--;
|
||||
if (EG(This)->refcount == 1) {
|
||||
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
|
||||
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
|
||||
}
|
||||
if (should_change_scope && EG(This) != current_this) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
}
|
||||
zval_ptr_dtor(&EG(This));
|
||||
} else if (should_change_scope) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
}
|
||||
@@ -2879,10 +2914,11 @@ int zend_return_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
|
||||
if (!(*retval_ptr_ptr)->is_ref) {
|
||||
if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr
|
||||
|| (opline->extended_value == ZEND_RETURNS_FUNCTION && !EX_T(opline->op1.u.var).var.fcall_returned_reference)) {
|
||||
zend_error(E_STRICT, "Only variable references should be returned by reference");
|
||||
if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
|
||||
EX_T(opline->op1.u.var).var.fcall_returned_reference) {
|
||||
} else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) {
|
||||
PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
|
||||
zend_error(E_STRICT, "Only variable references should be returned by reference");
|
||||
goto return_by_value;
|
||||
}
|
||||
}
|
||||
@@ -2896,16 +2932,27 @@ return_by_value:
|
||||
retval_ptr = get_zval_ptr(&opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
|
||||
|
||||
if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
|
||||
char *class_name;
|
||||
zend_uint class_name_len;
|
||||
int dup;
|
||||
|
||||
dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
|
||||
|
||||
ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
|
||||
**EG(return_value_ptr_ptr) = *retval_ptr;
|
||||
INIT_PZVAL(*EG(return_value_ptr_ptr));
|
||||
if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(retval_ptr)->name);
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name);
|
||||
}
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name);
|
||||
zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
|
||||
(*EG(return_value_ptr_ptr))->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
|
||||
|
||||
if(!dup) {
|
||||
efree(class_name);
|
||||
}
|
||||
} else if (!EG(free_op1)) { /* Not a temp var */
|
||||
if (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0) {
|
||||
if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
|
||||
(PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) {
|
||||
ALLOC_ZVAL(*(EG(return_value_ptr_ptr)));
|
||||
**EG(return_value_ptr_ptr) = *retval_ptr;
|
||||
(*EG(return_value_ptr_ptr))->is_ref = 0;
|
||||
@@ -3036,7 +3083,10 @@ int zend_send_var_no_ref_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
|
||||
return zend_send_by_var_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
|
||||
}
|
||||
{
|
||||
if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) &&
|
||||
!EX_T(opline->op1.u.var).var.fcall_returned_reference) {
|
||||
zend_error(E_ERROR, "Only variables can be passed by reference");
|
||||
} else {
|
||||
zval *varptr;
|
||||
varptr = get_zval_ptr(&opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
|
||||
|
||||
@@ -3291,7 +3341,7 @@ int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
|
||||
ce = Z_OBJCE_P(obj);
|
||||
ce = (Z_OBJ_HT_P(obj)->get_class_entry) ? Z_OBJCE_P(obj) : NULL;
|
||||
clone = ce ? ce->clone : NULL;
|
||||
clone_call = Z_OBJ_HT_P(obj)->clone_obj;
|
||||
if (!clone_call) {
|
||||
@@ -3654,62 +3704,70 @@ int zend_unset_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
long index;
|
||||
|
||||
if (container) {
|
||||
HashTable *ht;
|
||||
|
||||
if (opline->extended_value == ZEND_UNSET_DIM) {
|
||||
switch (Z_TYPE_PP(container)) {
|
||||
case IS_ARRAY:
|
||||
ht = Z_ARRVAL_PP(container);
|
||||
case IS_ARRAY: {
|
||||
HashTable *ht = Z_ARRVAL_PP(container);
|
||||
switch (offset->type) {
|
||||
case IS_DOUBLE:
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
if (offset->type == IS_DOUBLE) {
|
||||
index = (long) offset->value.dval;
|
||||
} else {
|
||||
index = offset->value.lval;
|
||||
}
|
||||
|
||||
zend_hash_index_del(ht, index);
|
||||
break;
|
||||
case IS_STRING:
|
||||
zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_hash_del(ht, "", sizeof(""));
|
||||
break;
|
||||
default:
|
||||
zend_error(E_WARNING, "Illegal offset type in unset");
|
||||
break;
|
||||
}
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
break;
|
||||
}
|
||||
case IS_OBJECT:
|
||||
ht = NULL;
|
||||
if (!Z_OBJ_HT_P(*container)->unset_dimension) {
|
||||
zend_error(E_ERROR, "Cannot use object as array");
|
||||
}
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
Z_OBJ_HT_P(*container)->unset_dimension(*container, offset TSRMLS_CC);
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&offset);
|
||||
}
|
||||
break;
|
||||
case IS_STRING:
|
||||
zend_error(E_ERROR, "Cannot unset string offsets");
|
||||
return 0; /* bailed out before */
|
||||
default:
|
||||
ht = NULL;
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
break;
|
||||
}
|
||||
} else { /* ZEND_UNSET_OBJ */
|
||||
ht = NULL;
|
||||
if (Z_TYPE_PP(container) == IS_OBJECT) {
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
if (ht) {
|
||||
switch (offset->type) {
|
||||
case IS_DOUBLE:
|
||||
case IS_RESOURCE:
|
||||
case IS_BOOL:
|
||||
case IS_LONG:
|
||||
if (offset->type == IS_DOUBLE) {
|
||||
index = (long) offset->value.dval;
|
||||
} else {
|
||||
index = offset->value.lval;
|
||||
}
|
||||
|
||||
zend_hash_index_del(ht, index);
|
||||
break;
|
||||
case IS_STRING:
|
||||
zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1);
|
||||
break;
|
||||
case IS_NULL:
|
||||
zend_hash_del(ht, "", sizeof(""));
|
||||
break;
|
||||
default:
|
||||
zend_error(E_WARNING, "Illegal offset type in unset");
|
||||
break;
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* overloaded element */
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
}
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
@@ -3727,6 +3785,12 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (array_ptr_ptr == NULL) {
|
||||
ALLOC_INIT_ZVAL(array_ptr);
|
||||
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
|
||||
if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
|
||||
zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class");
|
||||
opline++;
|
||||
SET_OPCODE(op_array->opcodes+opline->op2.u.opline_num);
|
||||
return 0;
|
||||
}
|
||||
ce = Z_OBJCE_PP(array_ptr_ptr);
|
||||
if (!ce || ce->get_iterator == NULL) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
|
||||
@@ -3747,7 +3811,7 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
*tmp = *array_ptr;
|
||||
INIT_PZVAL(tmp);
|
||||
array_ptr = tmp;
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
|
||||
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT && Z_OBJ_HT_P(array_ptr)->get_class_entry) {
|
||||
ce = Z_OBJCE_P(array_ptr);
|
||||
} else {
|
||||
array_ptr->refcount++;
|
||||
@@ -3760,7 +3824,6 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (iter && !EG(exception)) {
|
||||
array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
|
||||
} else {
|
||||
zval_ptr_dtor(&array_ptr);
|
||||
FREE_OP(Ts, op1, EG(free_op1));
|
||||
if (!EG(exception)) {
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name);
|
||||
@@ -3779,6 +3842,11 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
iter->index = 0;
|
||||
if (iter->funcs->rewind) {
|
||||
iter->funcs->rewind(iter TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
array_ptr->refcount--;
|
||||
zval_ptr_dtor(&array_ptr);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
|
||||
/* probably redundant */
|
||||
@@ -3855,13 +3923,28 @@ int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
/* This could cause an endless loop if index becomes zero again.
|
||||
* In case that ever happens we need an additional flag. */
|
||||
iter->funcs->move_forward(iter TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
array->refcount--;
|
||||
zval_ptr_dtor(&array);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
}
|
||||
if (!iter || iter->funcs->valid(iter TSRMLS_CC) == FAILURE) {
|
||||
/* reached end of iteration */
|
||||
if (EG(exception)) {
|
||||
array->refcount--;
|
||||
zval_ptr_dtor(&array);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
SET_OPCODE(op_array->opcodes+opline->op2.u.opline_num);
|
||||
return 0; /* CHECK_ME */
|
||||
}
|
||||
iter->funcs->get_current_data(iter, &value TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
array->refcount--;
|
||||
zval_ptr_dtor(&array);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
if (!value) {
|
||||
/* failure in get_current_data */
|
||||
SET_OPCODE(op_array->opcodes+opline->op2.u.opline_num);
|
||||
@@ -3869,6 +3952,11 @@ int zend_fe_fetch_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
if (iter->funcs->get_current_key) {
|
||||
key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
|
||||
if (EG(exception)) {
|
||||
array->refcount--;
|
||||
zval_ptr_dtor(&array);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
} else {
|
||||
key_type = HASH_KEY_IS_LONG;
|
||||
int_key = iter->index;
|
||||
@@ -3991,12 +4079,13 @@ int zend_isset_isempty_var_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
zval **container = get_obj_zval_ptr_ptr(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
|
||||
zval *offset = get_zval_ptr(&opline->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
|
||||
zval **value = NULL;
|
||||
int result = 0;
|
||||
long index;
|
||||
|
||||
if (container) {
|
||||
zval *offset = get_zval_ptr(&opline->op2, EX(Ts), &EG(free_op2), BP_VAR_R);
|
||||
|
||||
if ((*container)->type == IS_ARRAY) {
|
||||
HashTable *ht;
|
||||
int isset = 0;
|
||||
@@ -4049,12 +4138,19 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
|
||||
}
|
||||
break;
|
||||
}
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
} else if ((*container)->type == IS_OBJECT) {
|
||||
if (EG(free_op2)) {
|
||||
MAKE_REAL_ZVAL_PTR(offset);
|
||||
}
|
||||
if (prop_dim) {
|
||||
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
|
||||
} else {
|
||||
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
|
||||
}
|
||||
if (EG(free_op2)) {
|
||||
zval_ptr_dtor(&offset);
|
||||
}
|
||||
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
|
||||
zval tmp;
|
||||
|
||||
@@ -4076,6 +4172,9 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
|
||||
}
|
||||
break;
|
||||
}
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
} else {
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4090,8 +4189,6 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
|
||||
break;
|
||||
}
|
||||
|
||||
FREE_OP(EX(Ts), &opline->op2, EG(free_op2));
|
||||
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -4234,7 +4331,7 @@ int zend_instanceof_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
zval *expr = get_zval_ptr(&opline->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
|
||||
zend_bool result;
|
||||
|
||||
if (Z_TYPE_P(expr) == IS_OBJECT) {
|
||||
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
|
||||
result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.u.var).class_entry TSRMLS_CC);
|
||||
} else {
|
||||
result = 0;
|
||||
@@ -4284,6 +4381,7 @@ int zend_handle_exception_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
while (*stack_zval_pp != NULL) {
|
||||
zval_ptr_dtor(stack_zval_pp);
|
||||
EG(argument_stack).top_element--;
|
||||
EG(argument_stack).top--;
|
||||
stack_zval_pp--;
|
||||
}
|
||||
|
||||
@@ -4298,6 +4396,13 @@ int zend_handle_exception_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
while (EX(fbc)) {
|
||||
if (EX(object)) {
|
||||
zval_ptr_dtor(&EX(object));
|
||||
}
|
||||
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
|
||||
}
|
||||
|
||||
if (encapsulating_block == -1) {
|
||||
RETURN_FROM_EXECUTE_LOOP(execute_data);
|
||||
} else {
|
||||
|
||||
@@ -49,6 +49,7 @@ ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_pt
|
||||
|
||||
void init_executor(TSRMLS_D);
|
||||
void shutdown_executor(TSRMLS_D);
|
||||
void shutdown_destructors(TSRMLS_D);
|
||||
ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
|
||||
ZEND_API int zend_is_true(zval *op);
|
||||
|
||||
+77
-19
@@ -185,6 +185,15 @@ void init_executor(TSRMLS_D)
|
||||
EG(This) = NULL;
|
||||
}
|
||||
|
||||
void shutdown_destructors(TSRMLS_D) {
|
||||
zend_try {
|
||||
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_catch {
|
||||
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
|
||||
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
void shutdown_executor(TSRMLS_D)
|
||||
{
|
||||
zend_try {
|
||||
@@ -204,7 +213,6 @@ void shutdown_executor(TSRMLS_D)
|
||||
}
|
||||
*/
|
||||
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
|
||||
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
|
||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
|
||||
} zend_catch {
|
||||
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
|
||||
@@ -277,11 +285,6 @@ void shutdown_executor(TSRMLS_D)
|
||||
clean_non_persistent_constants(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
/* The regular list must be destroyed after the main symbol table,
|
||||
* op arrays, and constants are destroyed.
|
||||
*/
|
||||
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
|
||||
|
||||
zend_try {
|
||||
#if ZEND_DEBUG
|
||||
signal(SIGSEGV, original_sigsegv_handler);
|
||||
@@ -384,15 +387,17 @@ ZEND_API zend_bool zend_is_executing(TSRMLS_D)
|
||||
|
||||
ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
|
||||
{
|
||||
zval *zv = *zval_ptr;
|
||||
|
||||
#if DEBUG_ZEND>=2
|
||||
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
|
||||
#endif
|
||||
(*zval_ptr)->refcount--;
|
||||
if ((*zval_ptr)->refcount==0) {
|
||||
zval_dtor(*zval_ptr);
|
||||
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
|
||||
} else if ((*zval_ptr)->refcount == 1) {
|
||||
(*zval_ptr)->is_ref = 0;
|
||||
zv->refcount--;
|
||||
if (zv->refcount==0) {
|
||||
zval_dtor(zv);
|
||||
safe_free_zval_ptr_rel(zv ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
|
||||
} else if (zv->refcount == 1) {
|
||||
zv->is_ref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,11 +432,13 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
|
||||
if (p->type == IS_CONSTANT) {
|
||||
int refcount;
|
||||
zend_uchar is_ref;
|
||||
|
||||
SEPARATE_ZVAL(pp);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(pp);
|
||||
p = *pp;
|
||||
|
||||
refcount = p->refcount;
|
||||
is_ref = p->is_ref;
|
||||
|
||||
if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) {
|
||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||
@@ -448,15 +455,15 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
|
||||
*p = const_value;
|
||||
}
|
||||
|
||||
INIT_PZVAL(p);
|
||||
p->refcount = refcount;
|
||||
p->is_ref = is_ref;
|
||||
} else if (p->type == IS_CONSTANT_ARRAY) {
|
||||
zval **element, *new_val;
|
||||
char *str_index;
|
||||
uint str_index_len;
|
||||
ulong num_index;
|
||||
|
||||
SEPARATE_ZVAL(pp);
|
||||
SEPARATE_ZVAL_IF_NOT_REF(pp);
|
||||
p = *pp;
|
||||
p->type = IS_ARRAY;
|
||||
|
||||
@@ -562,6 +569,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
zend_op_array *original_op_array;
|
||||
zend_op **original_opline_ptr;
|
||||
zval *orig_free_op1, *orig_free_op2;
|
||||
zval *orig_garbage[2];
|
||||
int orig_garbage_ptr;
|
||||
int (*orig_unary_op)(zval *result, zval *op1);
|
||||
int (*orig_binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
zend_class_entry *current_scope;
|
||||
@@ -587,6 +596,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
/* Initialize execute_data */
|
||||
if (EG(current_execute_data)) {
|
||||
execute_data = *EG(current_execute_data);
|
||||
EX(op_array) = NULL;
|
||||
EX(opline) = NULL;
|
||||
} else {
|
||||
/* This only happens when we're called outside any execute()'s
|
||||
* It shouldn't be strictly necessary to NULL execute_data out,
|
||||
@@ -753,6 +764,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
zval *new_zval;
|
||||
|
||||
if (fci->no_separation) {
|
||||
if(i) {
|
||||
/* hack to clean up the stack */
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) (long) i, NULL);
|
||||
zend_ptr_stack_clear_multiple(TSRMLS_C);
|
||||
}
|
||||
return FAILURE;
|
||||
}
|
||||
ALLOC_ZVAL(new_zval);
|
||||
@@ -849,6 +865,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
orig_free_op2 = EG(free_op2);
|
||||
orig_unary_op = EG(unary_op);
|
||||
orig_binary_op = EG(binary_op);
|
||||
orig_garbage_ptr = EG(garbage_ptr);
|
||||
EG(garbage_ptr) = 0;
|
||||
if (orig_garbage_ptr > 0) {
|
||||
memcpy(&orig_garbage, &EG(garbage), sizeof(zval*)*orig_garbage_ptr);
|
||||
}
|
||||
zend_execute(EG(active_op_array) TSRMLS_CC);
|
||||
if (!fci->symbol_table) {
|
||||
zend_hash_destroy(EG(active_symbol_table));
|
||||
@@ -862,6 +883,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
|
||||
EG(free_op2) = orig_free_op2;
|
||||
EG(unary_op) = orig_unary_op;
|
||||
EG(binary_op) = orig_binary_op;
|
||||
if (orig_garbage_ptr > 0) {
|
||||
while (EG(garbage_ptr)) {
|
||||
zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);
|
||||
}
|
||||
EG(garbage_ptr) = orig_garbage_ptr;
|
||||
memcpy(&EG(garbage), &orig_garbage, sizeof(zval*)*orig_garbage_ptr);
|
||||
}
|
||||
} else {
|
||||
ALLOC_INIT_ZVAL(*fci->retval_ptr_ptr);
|
||||
if (EX(function_state).function->common.scope) {
|
||||
@@ -895,7 +923,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
{
|
||||
zval **args[1];
|
||||
zval autoload_function;
|
||||
zval class_name, *class_name_ptr = &class_name;
|
||||
zval *class_name_ptr;
|
||||
zval *retval_ptr;
|
||||
int retval;
|
||||
char *lc_name;
|
||||
@@ -934,8 +962,9 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
|
||||
ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0);
|
||||
|
||||
ALLOC_ZVAL(class_name_ptr);
|
||||
INIT_PZVAL(class_name_ptr);
|
||||
ZVAL_STRINGL(class_name_ptr, name, name_length, 0);
|
||||
ZVAL_STRINGL(class_name_ptr, name, name_length, 1);
|
||||
|
||||
args[0] = &class_name_ptr;
|
||||
|
||||
@@ -943,6 +972,8 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
EG(exception) = NULL;
|
||||
retval = call_user_function_ex(EG(function_table), NULL, &autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
|
||||
|
||||
zval_ptr_dtor(&class_name_ptr);
|
||||
|
||||
zend_hash_del(EG(in_autoload), lc_name, name_length+1);
|
||||
|
||||
if (retval == FAILURE) {
|
||||
@@ -1081,6 +1112,17 @@ void execute_new_code(TSRMLS_D)
|
||||
opline->op2.u.constant.is_ref = 1;
|
||||
opline->op2.u.constant.refcount = 2;
|
||||
}
|
||||
switch (opline->opcode) {
|
||||
case ZEND_JMP:
|
||||
opline->op1.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op1.u.opline_num];
|
||||
break;
|
||||
case ZEND_JMPZ:
|
||||
case ZEND_JMPNZ:
|
||||
case ZEND_JMPZ_EX:
|
||||
case ZEND_JMPNZ_EX:
|
||||
opline->op2.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op2.u.opline_num];
|
||||
break;
|
||||
}
|
||||
opline->handler = zend_opcode_handlers[opline->opcode];
|
||||
opline++;
|
||||
}
|
||||
@@ -1238,10 +1280,17 @@ void zend_set_timeout(long seconds)
|
||||
t_r.it_value.tv_sec = seconds;
|
||||
t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
setitimer(ITIMER_REAL, &t_r, NULL);
|
||||
signal(SIGALRM, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGALRM);
|
||||
# else
|
||||
setitimer(ITIMER_PROF, &t_r, NULL);
|
||||
signal(SIGPROF, zend_timeout);
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, SIGPROF);
|
||||
# endif
|
||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
# endif
|
||||
@@ -1260,7 +1309,11 @@ void zend_unset_timeout(TSRMLS_D)
|
||||
|
||||
no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
setitimer(ITIMER_REAL, &no_timeout, NULL);
|
||||
#else
|
||||
setitimer(ITIMER_PROF, &no_timeout, NULL);
|
||||
#endif
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
@@ -1296,7 +1349,11 @@ check_fetch_type:
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
|
||||
zend_error(E_ERROR, "Class '%s' not found", class_name);
|
||||
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
|
||||
zend_error(E_ERROR, "Interface '%s' not found", class_name);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Class '%s' not found", class_name);
|
||||
}
|
||||
}
|
||||
return *pce;
|
||||
}
|
||||
@@ -1339,8 +1396,9 @@ void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC)
|
||||
zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t) zend_verify_abstract_class_function, &ai TSRMLS_CC);
|
||||
|
||||
if (ai.cnt) {
|
||||
zend_error(E_ERROR, "Class %s contains %d abstract methods and must therefore be declared abstract (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
|
||||
zend_error(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
|
||||
ce->name, ai.cnt,
|
||||
ai.cnt > 1 ? "s" : "",
|
||||
DISPLAY_ABSTRACT_FN(0),
|
||||
DISPLAY_ABSTRACT_FN(1),
|
||||
DISPLAY_ABSTRACT_FN(2)
|
||||
|
||||
+1
-1
@@ -1054,7 +1054,7 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint
|
||||
if (p) {
|
||||
if (p->nKeyLength) {
|
||||
if (duplicate) {
|
||||
*str_index = estrndup(p->arKey, p->nKeyLength);
|
||||
*str_index = estrndup(p->arKey, p->nKeyLength-1);
|
||||
} else {
|
||||
*str_index = p->arKey;
|
||||
}
|
||||
|
||||
+3
-11
@@ -71,17 +71,9 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
|
||||
|
||||
while (ptr<end) {
|
||||
if (*ptr==' ') {
|
||||
/* Series of spaces should be displayed as 's
|
||||
* whereas single spaces should be displayed as a space
|
||||
*/
|
||||
if ((ptr+1) < end && *(ptr+1)==' ') {
|
||||
do {
|
||||
zend_html_putc(*ptr);
|
||||
} while ((++ptr < end) && (*ptr==' '));
|
||||
} else {
|
||||
ZEND_PUTC(*ptr);
|
||||
ptr++;
|
||||
}
|
||||
do {
|
||||
zend_html_putc(*ptr);
|
||||
} while ((++ptr < end) && (*ptr==' '));
|
||||
} else {
|
||||
zend_html_putc(*ptr++);
|
||||
}
|
||||
|
||||
+6
-1
@@ -48,7 +48,12 @@ static int zend_restore_ini_entry_cb(zend_ini_entry *ini_entry, int stage TSRMLS
|
||||
{
|
||||
if (ini_entry->modified) {
|
||||
if (ini_entry->on_modify) {
|
||||
ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
|
||||
zend_try {
|
||||
/* even if on_modify bails out, we have to continue on with restoring,
|
||||
since there can be allocated variables that would be freed on MM shutdown
|
||||
and would lead to memory corruption later ini entry is modified again */
|
||||
ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
}
|
||||
efree(ini_entry->value);
|
||||
ini_entry->value = ini_entry->orig_value;
|
||||
|
||||
@@ -291,9 +291,9 @@ unticked_class_declaration_statement:
|
||||
|
||||
|
||||
class_entry_type:
|
||||
T_CLASS { $$.u.constant.value.lval = 0; }
|
||||
| T_ABSTRACT T_CLASS { $$.u.constant.value.lval = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
|
||||
| T_FINAL T_CLASS { $$.u.constant.value.lval = ZEND_ACC_FINAL_CLASS; }
|
||||
T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = 0; }
|
||||
| T_ABSTRACT T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
|
||||
| T_FINAL T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_FINAL_CLASS; }
|
||||
;
|
||||
|
||||
extends_from:
|
||||
@@ -302,7 +302,7 @@ extends_from:
|
||||
;
|
||||
|
||||
interface_entry:
|
||||
T_INTERFACE { $$.u.constant.value.lval = ZEND_ACC_INTERFACE; }
|
||||
T_INTERFACE { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_INTERFACE; }
|
||||
;
|
||||
|
||||
interface_extends_list:
|
||||
|
||||
@@ -125,7 +125,8 @@ void startup_scanner(TSRMLS_D)
|
||||
{
|
||||
CG(heredoc) = NULL;
|
||||
CG(heredoc_len)=0;
|
||||
RESET_DOC_COMMENT();
|
||||
CG(doc_comment) = NULL;
|
||||
CG(doc_comment_len) = 0;
|
||||
SCNG(yy_start_stack_ptr) = 0;
|
||||
SCNG(yy_start_stack_depth) = 0;
|
||||
SCNG(current_buffer) = NULL;
|
||||
@@ -1464,6 +1465,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
|
||||
<ST_IN_SCRIPTING>"/**"{WHITESPACE} {
|
||||
CG(comment_start_line) = CG(zend_lineno);
|
||||
RESET_DOC_COMMENT();
|
||||
BEGIN(ST_DOC_COMMENT);
|
||||
yymore();
|
||||
}
|
||||
@@ -1480,7 +1482,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
|
||||
}
|
||||
|
||||
<ST_DOC_COMMENT>"*/" {
|
||||
CG(doc_comment) = yytext; /* no copying - intentional */
|
||||
CG(doc_comment) = estrndup(yytext, yyleng);
|
||||
CG(doc_comment_len) = yyleng;
|
||||
HANDLE_NEWLINES(yytext, yyleng);
|
||||
BEGIN(ST_IN_SCRIPTING);
|
||||
|
||||
+11
-5
@@ -114,16 +114,20 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
|
||||
void *resource;
|
||||
va_list resource_types;
|
||||
int i;
|
||||
|
||||
char *space;
|
||||
char *class_name;
|
||||
|
||||
if (default_id==-1) { /* use id */
|
||||
if (!passed_id) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "%s(): no %s resource supplied", get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
} else if ((*passed_id)->type != IS_RESOURCE) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "%s(): supplied argument is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -135,7 +139,8 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
|
||||
resource = zend_list_find(id, &actual_resource_type);
|
||||
if (!resource) {
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "%s(): %d is not a valid %s resource", get_active_function_name(TSRMLS_C), id, resource_type_name);
|
||||
class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s(): %d is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), id, resource_type_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -153,7 +158,8 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
|
||||
va_end(resource_types);
|
||||
|
||||
if (resource_type_name) {
|
||||
zend_error(E_WARNING, "%s(): supplied resource is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
class_name = get_active_class_name(&space TSRMLS_CC);
|
||||
zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(TSRMLS_C), resource_type_name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
+79
-43
@@ -162,13 +162,7 @@ static int zend_verify_property_access(zend_property_info *property_info, zend_c
|
||||
case ZEND_ACC_PUBLIC:
|
||||
return 1;
|
||||
case ZEND_ACC_PROTECTED:
|
||||
while (ce) {
|
||||
if (ce==EG(scope)) {
|
||||
return 1;
|
||||
}
|
||||
ce = ce->parent;
|
||||
}
|
||||
return 0;
|
||||
return zend_check_protected(ce, EG(scope));;
|
||||
case ZEND_ACC_PRIVATE:
|
||||
if (ce==EG(scope) && EG(scope)) {
|
||||
return 1;
|
||||
@@ -198,22 +192,41 @@ static inline zend_property_info *zend_get_property_info(zend_object *zobj, zval
|
||||
zend_property_info *property_info = NULL;
|
||||
zend_property_info *scope_property_info;
|
||||
zend_bool denied_access = 0;
|
||||
|
||||
ulong h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member)+1);
|
||||
if (zend_hash_quick_find(&zobj->ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
|
||||
if (zend_verify_property_access(property_info, zobj->ce TSRMLS_CC)) {
|
||||
if (property_info->flags & ZEND_ACC_CHANGED
|
||||
&& !(property_info->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* We still need to make sure that we're not in a context
|
||||
* where the right property is a different 'statically linked' private
|
||||
* continue checking below...
|
||||
*/
|
||||
ulong h;
|
||||
|
||||
if (Z_STRVAL_P(member)[0] == '\0') {
|
||||
if (!silent) {
|
||||
if (Z_STRLEN_P(member) == 0) {
|
||||
zend_error(E_ERROR, "Cannot access empty property");
|
||||
} else {
|
||||
return property_info;
|
||||
zend_error(E_ERROR, "Cannot access property started with '\\0'");
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
|
||||
if (zend_hash_quick_find(&zobj->ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
|
||||
if(property_info->flags & ZEND_ACC_SHADOW) {
|
||||
/* if it's a shadow - go to access it's private */
|
||||
property_info = NULL;
|
||||
} else {
|
||||
/* Try to look in the scope instead */
|
||||
denied_access = 1;
|
||||
if (zend_verify_property_access(property_info, zobj->ce TSRMLS_CC)) {
|
||||
if (property_info->flags & ZEND_ACC_CHANGED
|
||||
&& !(property_info->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* We still need to make sure that we're not in a context
|
||||
* where the right property is a different 'statically linked' private
|
||||
* continue checking below...
|
||||
*/
|
||||
} else {
|
||||
if (!silent && (property_info->flags & ZEND_ACC_STATIC)) {
|
||||
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", zobj->ce->name, Z_STRVAL_P(member));
|
||||
}
|
||||
return property_info;
|
||||
}
|
||||
} else {
|
||||
/* Try to look in the scope instead */
|
||||
denied_access = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (EG(scope) != zobj->ce
|
||||
@@ -221,6 +234,9 @@ static inline zend_property_info *zend_get_property_info(zend_object *zobj, zval
|
||||
&& EG(scope)
|
||||
&& zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS
|
||||
&& scope_property_info->flags & ZEND_ACC_PRIVATE) {
|
||||
if (!silent && (scope_property_info->flags & ZEND_ACC_STATIC)) {
|
||||
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", EG(scope)->name, Z_STRVAL_P(member));
|
||||
}
|
||||
return scope_property_info;
|
||||
} else if (property_info) {
|
||||
if (denied_access) {
|
||||
@@ -255,9 +271,14 @@ ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name
|
||||
if (!property_info) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (prop_info_name[0] == '\0' && prop_info_name[1] != '*' && !(property_info->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* we we're looking for a private prop but found a non private one of the same name */
|
||||
return FAILURE;
|
||||
if (prop_info_name[0] == '\0' && prop_info_name[1] != '*') {
|
||||
if (!(property_info->flags & ZEND_ACC_PRIVATE)) {
|
||||
/* we we're looking for a private prop but found a non private one of the same name */
|
||||
return FAILURE;
|
||||
} else if (strcmp(prop_info_name+1, property_info->name+1)) {
|
||||
/* we we're looking for a private prop but found a private one of the same name but another class */
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
return zend_verify_property_access(property_info, zobj->ce TSRMLS_CC) ? SUCCESS : FAILURE;
|
||||
}
|
||||
@@ -265,7 +286,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name
|
||||
zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval *tmp_member = NULL;
|
||||
zval **retval;
|
||||
zval *rv = NULL;
|
||||
zend_property_info *property_info;
|
||||
@@ -275,10 +296,12 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
if (member->type != IS_STRING) {
|
||||
tmp_member = *member;
|
||||
zval_copy_ctor(&tmp_member);
|
||||
convert_to_string(&tmp_member);
|
||||
member = &tmp_member;
|
||||
ALLOC_ZVAL(tmp_member);
|
||||
*tmp_member = *member;
|
||||
INIT_PZVAL(tmp_member);
|
||||
zval_copy_ctor(tmp_member);
|
||||
convert_to_string(tmp_member);
|
||||
member = tmp_member;
|
||||
}
|
||||
|
||||
#if DEBUG_OBJECT_HANDLERS
|
||||
@@ -306,8 +329,10 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
retval = &EG(uninitialized_zval_ptr);
|
||||
}
|
||||
}
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
if (tmp_member) {
|
||||
(*retval)->refcount++;
|
||||
zval_ptr_dtor(&tmp_member);
|
||||
(*retval)->refcount--;
|
||||
}
|
||||
return *retval;
|
||||
}
|
||||
@@ -316,7 +341,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
|
||||
static void zend_std_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
zval *tmp_member = NULL;
|
||||
zval **variable_ptr;
|
||||
int setter_done = 0;
|
||||
zend_property_info *property_info;
|
||||
@@ -324,10 +349,12 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
|
||||
zobj = Z_OBJ_P(object);
|
||||
|
||||
if (member->type != IS_STRING) {
|
||||
tmp_member = *member;
|
||||
zval_copy_ctor(&tmp_member);
|
||||
convert_to_string(&tmp_member);
|
||||
member = &tmp_member;
|
||||
ALLOC_ZVAL(tmp_member);
|
||||
*tmp_member = *member;
|
||||
INIT_PZVAL(tmp_member);
|
||||
zval_copy_ctor(tmp_member);
|
||||
convert_to_string(tmp_member);
|
||||
member = tmp_member;
|
||||
}
|
||||
|
||||
property_info = zend_get_property_info(zobj, member, 0 TSRMLS_CC);
|
||||
@@ -371,8 +398,8 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
|
||||
}
|
||||
zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &value, sizeof(zval *), (void **) &foo);
|
||||
}
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
if (tmp_member) {
|
||||
zval_ptr_dtor(&tmp_member);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,7 +639,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS)
|
||||
* Returns the function address that should be called, or NULL
|
||||
* if no such function exists.
|
||||
*/
|
||||
static inline zend_function *zend_check_private(zend_function *fbc, zend_class_entry *ce, int fn_flags, char *function_name_strval, int function_name_strlen TSRMLS_DC)
|
||||
static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
|
||||
{
|
||||
if (!ce) {
|
||||
return 0;
|
||||
@@ -647,6 +674,11 @@ static inline zend_function *zend_check_private(zend_function *fbc, zend_class_e
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
|
||||
{
|
||||
return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen TSRMLS_CC) != NULL;
|
||||
}
|
||||
|
||||
/* Ensures that we're allowed to call a protected method.
|
||||
*/
|
||||
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope)
|
||||
@@ -714,7 +746,8 @@ static union _zend_function *zend_std_get_method(zval *object, char *method_name
|
||||
zend_function *priv_fbc;
|
||||
|
||||
if (zend_hash_find(&EG(scope)->function_table, lc_method_name, method_len+1, (void **) &priv_fbc)==SUCCESS
|
||||
&& priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
&& priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE
|
||||
&& priv_fbc->common.scope == EG(scope)) {
|
||||
fbc = priv_fbc;
|
||||
}
|
||||
}
|
||||
@@ -723,7 +756,7 @@ static union _zend_function *zend_std_get_method(zval *object, char *method_name
|
||||
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
updated_fbc = zend_check_private(fbc, object->value.obj.handlers->get_class_entry(object TSRMLS_CC), fbc->common.fn_flags, lc_method_name, method_len TSRMLS_CC);
|
||||
updated_fbc = zend_check_private_int(fbc, object->value.obj.handlers->get_class_entry(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC);
|
||||
if (!updated_fbc) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
@@ -761,7 +794,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
|
||||
|
||||
/* Ensure that if we're calling a private function, we're allowed to do so.
|
||||
*/
|
||||
updated_fbc = zend_check_private(fbc, EG(scope), fbc->common.fn_flags, function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC);
|
||||
if (!updated_fbc) {
|
||||
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
|
||||
}
|
||||
@@ -785,7 +818,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
|
||||
zend_property_info *property_info;
|
||||
zend_property_info std_property_info;
|
||||
|
||||
if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE) {
|
||||
if (zend_hash_find(&ce->properties_info, property_name, property_name_len+1, (void **) &property_info)==FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
|
||||
std_property_info.flags = ZEND_ACC_PUBLIC;
|
||||
std_property_info.name = property_name;
|
||||
std_property_info.name_length = property_name_len;
|
||||
@@ -793,7 +826,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
|
||||
property_info = &std_property_info;
|
||||
}
|
||||
|
||||
#if 1&&DEBUG_OBJECT_HANDLERS
|
||||
#if DEBUG_OBJECT_HANDLERS
|
||||
zend_printf("Access type for %s::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags));
|
||||
#endif
|
||||
|
||||
@@ -944,6 +977,9 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||
|
||||
switch (type) {
|
||||
case IS_STRING:
|
||||
if (!zend_hash_exists(&Z_OBJCE_P(readobj)->function_table, "__tostring", sizeof("__tostring"))) {
|
||||
return FAILURE;
|
||||
}
|
||||
ZVAL_STRING(&fname, "__tostring", 0);
|
||||
if (call_user_function_ex(NULL, &readobj, &fname, &retval, 0, NULL, 0, NULL TSRMLS_CC) == SUCCESS) {
|
||||
if (retval) {
|
||||
|
||||
@@ -137,6 +137,8 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
|
||||
#define IS_ZEND_STD_OBJECT(z) ((z).type == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
|
||||
#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
|
||||
|
||||
ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC);
|
||||
|
||||
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
|
||||
|
||||
ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC);
|
||||
|
||||
+25
-1
@@ -111,9 +111,33 @@ ZEND_API zend_object *zend_objects_get_address(zval *zobject TSRMLS_DC)
|
||||
return (zend_object *)zend_object_store_get_object(zobject TSRMLS_CC);
|
||||
}
|
||||
|
||||
static void zval_add_ref_or_clone(zval **p)
|
||||
{
|
||||
if (Z_TYPE_PP(p) == IS_OBJECT && !PZVAL_IS_REF(*p)) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (Z_OBJ_HANDLER_PP(p, clone_obj) == NULL) {
|
||||
zend_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_PP(p)->name);
|
||||
} else {
|
||||
zval *orig = *p;
|
||||
|
||||
ALLOC_ZVAL(*p);
|
||||
**p = *orig;
|
||||
INIT_PZVAL(*p);
|
||||
(*p)->value.obj = Z_OBJ_HT_PP(p)->clone_obj(orig TSRMLS_CC);
|
||||
}
|
||||
} else {
|
||||
(*p)->refcount++;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_clone_members(zend_object *new_object, zend_object_value new_obj_val, zend_object *old_object, zend_object_handle handle TSRMLS_DC)
|
||||
{
|
||||
zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
|
||||
if (EG(ze1_compatibility_mode)) {
|
||||
zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref_or_clone, (void *) NULL /* Not used anymore */, sizeof(zval *));
|
||||
} else {
|
||||
zend_hash_copy(new_object->properties, old_object->properties, (copy_ctor_func_t) zval_add_ref, (void *) NULL /* Not used anymore */, sizeof(zval *));
|
||||
}
|
||||
if (old_object->ce->clone) {
|
||||
zval *new_obj;
|
||||
zval *clone_func_name;
|
||||
|
||||
@@ -151,7 +151,9 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
|
||||
EG(objects_store).object_buckets[handle].destructor_called = 1;
|
||||
|
||||
if (obj->dtor) {
|
||||
zobject->refcount++;
|
||||
obj->dtor(obj->object, handle TSRMLS_CC);
|
||||
zobject->refcount--;
|
||||
}
|
||||
}
|
||||
if (obj->refcount == 1) {
|
||||
|
||||
@@ -1284,24 +1284,26 @@ static inline void zend_free_obj_get_result(zval *op, int free_op)
|
||||
}
|
||||
|
||||
#define COMPARE_RETURN_AND_FREE(retval) \
|
||||
zend_free_obj_get_result(op1, free_op1); \
|
||||
zend_free_obj_get_result(op2, free_op2); \
|
||||
zend_free_obj_get_result(op1_orig, free_op1); \
|
||||
zend_free_obj_get_result(op2_orig, free_op2); \
|
||||
return retval;
|
||||
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
zend_bool free_op1 = 0, free_op2 = 0;
|
||||
zval *op1_orig, *op2_orig;
|
||||
|
||||
if (op1->type == IS_OBJECT && Z_OBJ_HT_P(op1)->get) {
|
||||
op1 = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC);
|
||||
free_op1 = 1;
|
||||
}
|
||||
op1_orig = op1;
|
||||
if (op2->type == IS_OBJECT && Z_OBJ_HT_P(op2)->get) {
|
||||
op2 = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC);
|
||||
free_op2 = 1;
|
||||
}
|
||||
|
||||
op2_orig = op2;
|
||||
|
||||
if ((op1->type == IS_NULL && op2->type == IS_STRING)
|
||||
|| (op2->type == IS_NULL && op1->type == IS_STRING)) {
|
||||
|
||||
+18
-10
@@ -257,7 +257,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde
|
||||
/* {{{ _class_string */
|
||||
static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *indent TSRMLS_DC)
|
||||
{
|
||||
int count, count_static_props = 0, count_static_funcs = 0;
|
||||
int count, count_static_props = 0, count_static_funcs = 0, count_shadow_props = 0;
|
||||
string sub_indent;
|
||||
|
||||
string_init(&sub_indent);
|
||||
@@ -349,7 +349,9 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
|
||||
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
|
||||
if (prop->flags & ZEND_ACC_STATIC) {
|
||||
if(prop->flags & ZEND_ACC_SHADOW) {
|
||||
count_shadow_props++;
|
||||
} else if (prop->flags & ZEND_ACC_STATIC) {
|
||||
count_static_props++;
|
||||
}
|
||||
zend_hash_move_forward_ex(&ce->properties_info, &pos);
|
||||
@@ -365,9 +367,10 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
|
||||
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
|
||||
if (prop->flags & ZEND_ACC_STATIC) {
|
||||
if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) {
|
||||
_property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_hash_move_forward_ex(&ce->properties_info, &pos);
|
||||
}
|
||||
}
|
||||
@@ -415,7 +418,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
|
||||
|
||||
/* Default/Implicit properties */
|
||||
if (&ce->properties_info) {
|
||||
count = zend_hash_num_elements(&ce->properties_info) - count_static_props;
|
||||
count = zend_hash_num_elements(&ce->properties_info) - count_static_props - count_shadow_props;
|
||||
string_printf(str, "\n%s - Properties [%d] {\n", indent, count);
|
||||
if (count > 0) {
|
||||
HashPosition pos;
|
||||
@@ -424,7 +427,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
|
||||
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
|
||||
|
||||
while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
|
||||
if (!(prop->flags & ZEND_ACC_STATIC)) {
|
||||
if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) {
|
||||
_property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
|
||||
}
|
||||
zend_hash_move_forward_ex(&ce->properties_info, &pos);
|
||||
@@ -1332,6 +1335,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
|
||||
/* Return an empty array in case no static variables exist */
|
||||
array_init(return_value);
|
||||
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
|
||||
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
}
|
||||
@@ -1745,7 +1749,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
|
||||
|
||||
zv_copy = precv->op2.u.constant;
|
||||
zv = &zv_copy;
|
||||
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
|
||||
zval_update_constant(&zv, (void*)0 TSRMLS_CC);
|
||||
RETURN_ZVAL(zv, 1, 1);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2315,7 +2319,7 @@ ZEND_METHOD(reflection_class, getConstructor)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod ReflectionClass::getMethod(string name) throws ReflectionException
|
||||
Returns the class' method specified by it's name */
|
||||
Returns the class' method specified by its name */
|
||||
ZEND_METHOD(reflection_class, getMethod)
|
||||
{
|
||||
reflection_object *intern;
|
||||
@@ -2388,7 +2392,7 @@ ZEND_METHOD(reflection_class, getMethods)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionProperty ReflectionClass::getProperty(string name) throws ReflectionException
|
||||
Returns the class' property specified by it's name */
|
||||
Returns the class' property specified by its name */
|
||||
ZEND_METHOD(reflection_class, getProperty)
|
||||
{
|
||||
reflection_object *intern;
|
||||
@@ -2403,7 +2407,7 @@ ZEND_METHOD(reflection_class, getProperty)
|
||||
}
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS) {
|
||||
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) {
|
||||
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
|
||||
} else {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
@@ -2421,6 +2425,10 @@ static int _addproperty(zend_property_info *pptr, int num_args, va_list args, ze
|
||||
zval *retval = va_arg(args, zval*);
|
||||
long filter = va_arg(args, long);
|
||||
|
||||
if (pptr->flags & ZEND_ACC_SHADOW) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pptr->flags & filter) {
|
||||
TSRMLS_FETCH();
|
||||
ALLOC_ZVAL(property);
|
||||
@@ -2904,7 +2912,7 @@ ZEND_METHOD(reflection_property, __construct)
|
||||
/* returns out of this function */
|
||||
}
|
||||
|
||||
if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE) {
|
||||
if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Property %s::$%s does not exist", ce->name, name_str);
|
||||
return;
|
||||
|
||||
@@ -94,7 +94,16 @@ ZEND_API size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_
|
||||
if (file_handle->handle.stream.interactive) {
|
||||
int c = '*', n;
|
||||
|
||||
#ifdef NETWARE
|
||||
/*
|
||||
c != 4 check is there as fread of a character in NetWare LibC gives 4 upon ^D character.
|
||||
Ascii value 4 is actually EOT character which is not defined anywhere in the LibC
|
||||
or else we can use instead of hardcoded 4.
|
||||
*/
|
||||
for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != 4 && c != '\n'; ++n )
|
||||
#else
|
||||
for ( n = 0; n < len && (c = zend_stream_getc( file_handle TSRMLS_CC)) != EOF && c != '\n'; ++n )
|
||||
#endif
|
||||
buf[n] = (char) c;
|
||||
if ( c == '\n' )
|
||||
buf[n++] = (char) c;
|
||||
|
||||
+58
-12
@@ -146,7 +146,7 @@ dnl choose the right compiler/flags/etc. for the source-file
|
||||
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
|
||||
*.cpp[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
|
||||
*.cpp|*.cc[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
|
||||
esac
|
||||
|
||||
dnl create a rule for the object/source combo
|
||||
@@ -1086,20 +1086,33 @@ AC_DEFUN([PHP_CHECK_CC_OPTION],[
|
||||
rm -rf conftest*
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl PHP_REGEX
|
||||
dnl
|
||||
AC_DEFUN([PHP_REGEX],[
|
||||
|
||||
if test "$REGEX_TYPE" = "php"; then
|
||||
AC_DEFINE(HSREGEX,1,[ ])
|
||||
AC_DEFINE(REGEX,1,[ ])
|
||||
PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
|
||||
elif test "$REGEX_TYPE" = "system"; then
|
||||
AC_DEFINE(REGEX,0,[ ])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([which regex library to use])
|
||||
AC_MSG_RESULT([$REGEX_TYPE])
|
||||
if test "$REGEX_TYPE" = "php"; then
|
||||
AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ])
|
||||
AC_DEFINE(HSREGEX,1,[ ])
|
||||
AC_DEFINE(REGEX,1,[ ])
|
||||
PHP_ADD_SOURCES(regex, regcomp.c regexec.c regerror.c regfree.c)
|
||||
elif test "$REGEX_TYPE" = "system"; then
|
||||
AC_DEFINE(REGEX,0,[ ])
|
||||
dnl Check if field re_magic exists in struct regex_t
|
||||
AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <regex.h>], [regex_t rt; rt.re_magic;],
|
||||
[ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])
|
||||
])
|
||||
if test "$ac_cv_regex_t_re_magic" = "yes"; then
|
||||
AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1)
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING([which regex library to use])
|
||||
AC_MSG_RESULT([$REGEX_TYPE])
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl See if we have broken header files like SunOS has.
|
||||
dnl
|
||||
@@ -1182,6 +1195,10 @@ AC_DEFUN([PHP_SHARED_MODULE],[
|
||||
suffix=so
|
||||
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
;;
|
||||
*netware*[)]
|
||||
suffix=nlm
|
||||
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
;;
|
||||
*[)]
|
||||
suffix=la
|
||||
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
|
||||
@@ -1270,6 +1287,11 @@ dnl ---------------------------------------------- Static module
|
||||
if test "$3" = "shared" || test "$3" = "yes"; then
|
||||
dnl ---------------------------------------------- Shared module
|
||||
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
|
||||
case $host_alias in
|
||||
*netware*)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(php5lib, netware, translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
|
||||
;;
|
||||
esac
|
||||
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
|
||||
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
|
||||
fi
|
||||
@@ -1680,6 +1702,10 @@ AC_DEFUN([PHP_SETUP_OPENSSL],[
|
||||
unset OPENSSL_INCDIR
|
||||
unset OPENSSL_LIBDIR
|
||||
|
||||
dnl Empty variable means 'no'
|
||||
test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
|
||||
test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
|
||||
|
||||
dnl Fallbacks for different configure options
|
||||
if test "$PHP_OPENSSL" != "no"; then
|
||||
PHP_OPENSSL_DIR=$PHP_OPENSSL
|
||||
@@ -2069,3 +2095,23 @@ int main(void)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_CHECK_PDO_INCLUDES([found [, not-found]])
|
||||
dnl
|
||||
AC_DEFUN([PHP_CHECK_PDO_INCLUDES],[
|
||||
AC_CACHE_CHECK([for PDO includes], pdo_inc_path, [
|
||||
AC_MSG_CHECKING([for PDO includes])
|
||||
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
|
||||
pdo_inc_path=$abs_srcdir/ext
|
||||
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
|
||||
pdo_inc_path=$abs_srcdir/ext
|
||||
elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
|
||||
pdo_inc_path=$prefix/include/php/ext
|
||||
fi
|
||||
])
|
||||
if test -n "$pdo_inc_path"; then
|
||||
ifelse([$1],[],:,[$1])
|
||||
else
|
||||
ifelse([$2],[],[AC_MSG_ERROR([Cannot find php_pdo_driver.h.])],[$2])
|
||||
fi
|
||||
])
|
||||
+5
-2
@@ -32,6 +32,9 @@ acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
|
||||
|
||||
targets = $(TOUCH_FILES) configure $(config_h_in)
|
||||
|
||||
PHP_AUTOCONF ?= 'autoconf'
|
||||
PHP_AUTOHEADER ?= 'autoheader'
|
||||
|
||||
SUPPRESS_WARNINGS ?= 2>&1 | (egrep -v '(AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used|AC_PROG_LEX invoked multiple times|AC_DECL_YYTEXT is expanded from...|the top level)'||true)
|
||||
|
||||
all: $(targets)
|
||||
@@ -45,7 +48,7 @@ $(config_h_in): configure acconfig.h
|
||||
# correctly otherwise (timestamps are not updated)
|
||||
@echo rebuilding $@
|
||||
@rm -f $@
|
||||
autoheader $(SUPPRESS_WARNINGS)
|
||||
$(PHP_AUTOHEADER) $(SUPPRESS_WARNINGS)
|
||||
|
||||
$(TOUCH_FILES):
|
||||
touch $(TOUCH_FILES)
|
||||
@@ -56,5 +59,5 @@ aclocal.m4: configure.in acinclude.m4
|
||||
|
||||
configure: aclocal.m4 configure.in $(config_m4_files)
|
||||
@echo rebuilding $@
|
||||
autoconf $(SUPPRESS_WARNINGS)
|
||||
$(PHP_AUTOCONF) $(SUPPRESS_WARNINGS)
|
||||
|
||||
+7
-2
@@ -16,15 +16,20 @@
|
||||
# | Sascha Schumann <sascha@schumann.cx> |
|
||||
# +----------------------------------------------------------------------+
|
||||
#
|
||||
# $Id: buildcheck.sh,v 1.30.2.4 2005-01-20 01:41:52 sniper Exp $
|
||||
# $Id: buildcheck.sh,v 1.30.2.6 2005-04-07 23:33:37 jon Exp $
|
||||
#
|
||||
|
||||
echo "buildconf: checking installation..."
|
||||
|
||||
stamp=$1
|
||||
|
||||
# Allow the autoconf executable to be overridden by $PHP_AUTOCONF.
|
||||
if test -z "$PHP_AUTOCONF"; then
|
||||
PHP_AUTOCONF='autoconf'
|
||||
fi
|
||||
|
||||
# autoconf 2.13 or newer
|
||||
ac_version=`autoconf --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
ac_version=`$PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.13 or newer installed"
|
||||
|
||||
+228
-151
@@ -1,12 +1,12 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## GNU shtool -- The GNU Portable Shell Tool
|
||||
## Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
## See http://www.gnu.org/software/shtool/ for more information.
|
||||
## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
|
||||
##
|
||||
## Version: 1.6.2 (02-Nov-2002)
|
||||
## Version: 2.0.2 (15-Jun-2005)
|
||||
## Contents: 4/19 available modules
|
||||
##
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
## rotate Logfile rotation
|
||||
## tarball Roll distribution tarballs
|
||||
## subst Apply sed(1) substitution operations
|
||||
## guessos Simple operating system guesser
|
||||
## platform Platform Identification Utility
|
||||
## arx Extended archive command
|
||||
## slo Separate linker options by library class
|
||||
## scpp Sharing C Pre-Processor
|
||||
@@ -66,9 +66,9 @@ if [ $# -eq 0 ]; then
|
||||
echo "$0:Hint: run \`$0 -h' for usage" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo "This is GNU shtool, version 1.6.2 (02-Nov-2002)"
|
||||
echo "Copyright (c) 1994-2002 Ralf S. Engelschall <rse@engelschall.com>"
|
||||
if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
|
||||
echo "This is GNU shtool, version 2.0.2 (15-Jun-2005)"
|
||||
echo "Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>"
|
||||
echo "Report bugs to <bug-shtool@gnu.org>"
|
||||
echo ''
|
||||
echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
|
||||
@@ -80,7 +80,7 @@ if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo ' -r, --recreate recreate this shtool script via shtoolize'
|
||||
echo ''
|
||||
echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
|
||||
echo ' echo [-n|--newline] [-e|--expand] [<str> ...]'
|
||||
echo ' echo [-n|--newline] [-e|--expand] [<string> ...]'
|
||||
echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
|
||||
echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
|
||||
echo ' [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
|
||||
@@ -106,17 +106,21 @@ if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
|
||||
echo ' <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
|
||||
echo ' [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
|
||||
echo ' [-b|--background] [-d|--delay] [-p|--pad <len>] [-o|--owner'
|
||||
echo ' <owner>] [-g|--group <group>] [-m|--mode <mode>] [-M|--migrate'
|
||||
echo ' [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode'
|
||||
echo ' <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate'
|
||||
echo ' <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
|
||||
echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
|
||||
echo ' [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
|
||||
echo ' <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
|
||||
echo ' <path> [<path> ...]'
|
||||
echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-s|--stealth]'
|
||||
echo ' [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>]'
|
||||
echo ' [-f|--file <cmd-file>] [<file>] [...]'
|
||||
echo ' guessos '
|
||||
echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]'
|
||||
echo ' [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup'
|
||||
echo ' <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>]'
|
||||
echo ' [...]'
|
||||
echo ' platform [-F|--format <format>] [-S|--sep <string>] [-C|--conc'
|
||||
echo ' <string>] [-L|--lower] [-U|--upper] [-v|--verbose]'
|
||||
echo ' [-c|--concise] [-n|--no-newline] [-t|--type <type>]'
|
||||
echo ' [-V|--version] [-h|--help]'
|
||||
echo ' arx [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
|
||||
echo ' ...]'
|
||||
echo ' slo [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
|
||||
@@ -131,15 +135,15 @@ if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
|
||||
echo ''
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
|
||||
echo "GNU shtool 1.6.2 (02-Nov-2002)"
|
||||
if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
|
||||
echo "GNU shtool 2.0.2 (15-Jun-2005)"
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
|
||||
if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
|
||||
shtoolize -oshtool echo install mkdir path
|
||||
exit 0
|
||||
fi
|
||||
if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
|
||||
if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then
|
||||
shift
|
||||
set -x
|
||||
fi
|
||||
@@ -166,7 +170,7 @@ gen_tmpfile=no
|
||||
case $tool in
|
||||
echo )
|
||||
str_tool="echo"
|
||||
str_usage="[-n|--newline] [-e|--expand] [<str> ...]"
|
||||
str_usage="[-n|--newline] [-e|--expand] [<string> ...]"
|
||||
arg_spec="0+"
|
||||
opt_spec="n.e."
|
||||
opt_alias="n:newline,e:expand"
|
||||
@@ -261,7 +265,7 @@ eval `echo h.$opt_spec |\
|
||||
|
||||
# parse option alias string
|
||||
eval `echo h:help,$opt_alias |\
|
||||
tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
|
||||
sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
|
||||
|
||||
# interate over argument line
|
||||
opt_PREV=''
|
||||
@@ -286,12 +290,12 @@ while [ $# -gt 0 ]; do
|
||||
--[a-zA-Z0-9]*=*)
|
||||
eval `echo "x$1" |\
|
||||
sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
|
||||
opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
|
||||
opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
|
||||
eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
|
||||
;;
|
||||
--[a-zA-Z0-9]*)
|
||||
opt_OPT=`echo "x$1" | cut -c4-`
|
||||
opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
|
||||
opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
|
||||
eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
|
||||
opt_ARG=''
|
||||
;;
|
||||
@@ -315,8 +319,8 @@ while [ $# -gt 0 ]; do
|
||||
|
||||
# determine whether option needs an argument
|
||||
eval "opt_MODE=\$opt_MODE_${opt_OPT}"
|
||||
if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
|
||||
if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
|
||||
if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
|
||||
if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
|
||||
opt_PREV="$opt_OPT"
|
||||
continue
|
||||
fi
|
||||
@@ -375,6 +379,7 @@ esac
|
||||
|
||||
# establish a temporary file on request
|
||||
if [ ".$gen_tmpfile" = .yes ]; then
|
||||
# create (explicitly) secure temporary directory
|
||||
if [ ".$TMPDIR" != . ]; then
|
||||
tmpdir="$TMPDIR"
|
||||
elif [ ".$TEMPDIR" != . ]; then
|
||||
@@ -382,12 +387,40 @@ if [ ".$gen_tmpfile" = .yes ]; then
|
||||
else
|
||||
tmpdir="/tmp"
|
||||
fi
|
||||
tmpfile="$tmpdir/.shtool.$$"
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
touch $tmpfile
|
||||
chmod 600 $tmpfile
|
||||
tmpdir="$tmpdir/.shtool.$$"
|
||||
( umask 077
|
||||
rm -rf "$tmpdir" >/dev/null 2>&1 || true
|
||||
mkdir "$tmpdir" >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
# create (implicitly) secure temporary file
|
||||
tmpfile="$tmpdir/shtool.tmp"
|
||||
touch "$tmpfile"
|
||||
fi
|
||||
|
||||
# utility function: map string to lower case
|
||||
util_lower () {
|
||||
echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
|
||||
}
|
||||
|
||||
# utility function: map string to upper case
|
||||
util_upper () {
|
||||
echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
}
|
||||
|
||||
# cleanup procedure
|
||||
shtool_exit () {
|
||||
rc="$1"
|
||||
if [ ".$gen_tmpfile" = .yes ]; then
|
||||
rm -rf "$tmpdir" >/dev/null 2>&1 || true
|
||||
fi
|
||||
exit $rc
|
||||
}
|
||||
|
||||
##
|
||||
## DISPATCH INTO SCRIPT BODY
|
||||
##
|
||||
@@ -397,12 +430,11 @@ case $tool in
|
||||
echo )
|
||||
##
|
||||
## echo -- Print string with optional construct expansion
|
||||
## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for WML as buildinfo
|
||||
## Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
|
||||
|
||||
text="$*"
|
||||
|
||||
|
||||
# check for broken escape sequence expansion
|
||||
seo=''
|
||||
bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
|
||||
@@ -412,18 +444,18 @@ echo )
|
||||
seo='-E'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# check for existing -n option (to suppress newline)
|
||||
minusn=''
|
||||
bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
|
||||
if [ ".$bytes" = .3 ]; then
|
||||
minusn='-n'
|
||||
fi
|
||||
|
||||
|
||||
# determine terminal bold sequence
|
||||
term_bold=''
|
||||
term_norm=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then
|
||||
case $TERM in
|
||||
# for the most important terminal types we directly know the sequences
|
||||
xterm|xterm*|vt220|vt220*)
|
||||
@@ -459,96 +491,139 @@ echo )
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
|
||||
if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
|
||||
if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then
|
||||
echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
|
||||
term_bold=''
|
||||
term_norm=''
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# determine user name
|
||||
username=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
|
||||
username="$LOGNAME"
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then
|
||||
username="`(id -un) 2>/dev/null`"
|
||||
if [ ".$username" = . ]; then
|
||||
username="$USER"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(whoami) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(who am i) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username='unknown'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine user id
|
||||
userid=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
|
||||
userid="`(id -u) 2>/dev/null`"
|
||||
if [ ".$userid" = . ]; then
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
|
||||
username=`echo $str | sed -e 's/^uid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'`
|
||||
fi
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`(ypcat passwd) 2>/dev/null |
|
||||
egrep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid='?'
|
||||
if [ ".$username" = . ]; then
|
||||
username="$LOGNAME"
|
||||
if [ ".$username" = . ]; then
|
||||
username="$USER"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(whoami) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username="`(who am i) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$username" = . ]; then
|
||||
username='unknown'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# determine user id
|
||||
userid=''
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then
|
||||
userid="`(id -u) 2>/dev/null`"
|
||||
if [ ".$userid" = . ]; then
|
||||
userid="`(id -u ${username}) 2>/dev/null`"
|
||||
if [ ".$userid" = . ]; then
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*$//'`
|
||||
fi
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`(getent passwd ${username}) 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid=`(ypcat passwd) 2>/dev/null |
|
||||
grep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$userid" = . ]; then
|
||||
userid='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# determine (primary) group id
|
||||
groupid=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
|
||||
groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then
|
||||
groupid="`(id -g ${username}) 2>/dev/null`"
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
groupid=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*//' -e 's/(.*$//'`
|
||||
fi
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid='?'
|
||||
groupid=`(getent passwd ${username}) 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \
|
||||
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
|
||||
if [ ".$groupid" = . ]; then
|
||||
groupid='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# determine (primary) group name
|
||||
groupname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
|
||||
groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then
|
||||
groupname="`(id -gn ${username}) 2>/dev/null`"
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname=`(ypcat group) 2>/dev/null | \
|
||||
egrep "^[^:]*:[^:]*:${groupid}:" | \
|
||||
sed -e 's/:.*$//'`
|
||||
str="`(id) 2>/dev/null`"
|
||||
if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then
|
||||
groupname=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'`
|
||||
fi
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname='?'
|
||||
groupname=`(getent group) 2>/dev/null | \
|
||||
grep "^[^:]*:[^:]*:${groupid}:" | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname=`(ypcat group) 2>/dev/null | \
|
||||
grep "^[^:]*:[^:]*:${groupid}:" | \
|
||||
sed -e 's/:.*$//'`
|
||||
if [ ".$groupname" = . ]; then
|
||||
groupname='?'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# determine host and domain name
|
||||
hostname=''
|
||||
domainname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then
|
||||
hostname="`(uname -n) 2>/dev/null |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$hostname" = . ]; then
|
||||
@@ -565,16 +640,16 @@ echo )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then
|
||||
if [ ".$domainname" = . ]; then
|
||||
if [ -f /etc/resolv.conf ]; then
|
||||
domainname="`egrep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
|
||||
domainname="`grep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
|
||||
sed -e 's/.*domain//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/^\.//' -e 's/^/./' |\
|
||||
awk '{ printf("%s", $1); }'`"
|
||||
if [ ".$domainname" = . ]; then
|
||||
domainname="`egrep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
|
||||
domainname="`grep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
|
||||
sed -e 's/.*search//' \
|
||||
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
|
||||
-e 's/ .*//' -e 's/ .*//' \
|
||||
@@ -584,13 +659,13 @@ echo )
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# determine current time
|
||||
time_day=''
|
||||
time_month=''
|
||||
time_year=''
|
||||
time_monthname=''
|
||||
if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
|
||||
if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then
|
||||
time_day=`date '+%d'`
|
||||
time_month=`date '+%m'`
|
||||
time_year=`date '+%Y' 2>/dev/null`
|
||||
@@ -616,7 +691,7 @@ echo )
|
||||
12) time_monthname='Dec' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
# expand special ``%x'' constructs
|
||||
if [ ".$opt_e" = .yes ]; then
|
||||
text=`echo $seo "$text" |\
|
||||
@@ -633,7 +708,7 @@ echo )
|
||||
-e "s/%Y/${time_year}/g" \
|
||||
-e "s/%m/${time_monthname}/g" 2>/dev/null`
|
||||
fi
|
||||
|
||||
|
||||
# create output
|
||||
if [ .$opt_n = .no ]; then
|
||||
echo $seo "$text"
|
||||
@@ -646,15 +721,16 @@ echo )
|
||||
echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
|
||||
fi
|
||||
fi
|
||||
|
||||
shtool_exit 0
|
||||
;;
|
||||
|
||||
install )
|
||||
##
|
||||
## install -- Install a program, script or datafile
|
||||
## Copyright (c) 1997-2002 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for shtool
|
||||
## Copyright (c) 1997-2005 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
|
||||
|
||||
# special case: "shtool install -d <dir> [...]" internally
|
||||
# maps to "shtool mkdir -f -p -m 755 <dir> [...]"
|
||||
if [ "$opt_d" = yes ]; then
|
||||
@@ -672,11 +748,11 @@ install )
|
||||
cmd="$cmd -t"
|
||||
fi
|
||||
for dir in "$@"; do
|
||||
eval "$cmd $dir" || exit $?
|
||||
eval "$cmd $dir" || shtool_exit $?
|
||||
done
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
|
||||
|
||||
# determine source(s) and destination
|
||||
argc=$#
|
||||
srcs=""
|
||||
@@ -685,30 +761,30 @@ install )
|
||||
shift
|
||||
done
|
||||
dstpath="$1"
|
||||
|
||||
|
||||
# type check for destination
|
||||
dstisdir=0
|
||||
if [ -d $dstpath ]; then
|
||||
dstpath=`echo "$dstpath" | sed -e 's:/$::'`
|
||||
dstisdir=1
|
||||
fi
|
||||
|
||||
|
||||
# consistency check for destination
|
||||
if [ $argc -gt 2 -a $dstisdir = 0 ]; then
|
||||
if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then
|
||||
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
|
||||
exit 1
|
||||
shtool_exit 1
|
||||
fi
|
||||
|
||||
|
||||
# iterate over all source(s)
|
||||
for src in $srcs; do
|
||||
dst=$dstpath
|
||||
|
||||
|
||||
# if destination is a directory, append the input filename
|
||||
if [ $dstisdir = 1 ]; then
|
||||
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
|
||||
dst="$dst/$dstfile"
|
||||
fi
|
||||
|
||||
|
||||
# check for correct arguments
|
||||
if [ ".$src" = ".$dst" ]; then
|
||||
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
|
||||
@@ -718,17 +794,17 @@ install )
|
||||
echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
# make a temp file name in the destination directory
|
||||
dsttmp=`echo $dst |\
|
||||
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
|
||||
-e "s;\$;/#INST@$$#;"`
|
||||
|
||||
|
||||
# verbosity
|
||||
if [ ".$opt_v" = .yes ]; then
|
||||
echo "$src -> $dst" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
# copy or move the file name to the temp name
|
||||
# (because we might be not allowed to change the source)
|
||||
if [ ".$opt_C" = .yes ]; then
|
||||
@@ -738,14 +814,14 @@ install )
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "cp $src $dsttmp" 1>&2
|
||||
fi
|
||||
cp $src $dsttmp || exit $?
|
||||
cp $src $dsttmp || shtool_exit $?
|
||||
else
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "mv $src $dsttmp" 1>&2
|
||||
fi
|
||||
mv $src $dsttmp || exit $?
|
||||
mv $src $dsttmp || shtool_exit $?
|
||||
fi
|
||||
|
||||
|
||||
# adjust the target file
|
||||
if [ ".$opt_e" != . ]; then
|
||||
sed='sed'
|
||||
@@ -755,34 +831,35 @@ install )
|
||||
sed="$sed -e '$e'"
|
||||
done
|
||||
cp $dsttmp $dsttmp.old
|
||||
eval "$sed <$dsttmp.old >$dsttmp" || exit $?
|
||||
chmod u+w $dsttmp
|
||||
eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
|
||||
rm -f $dsttmp.old
|
||||
fi
|
||||
if [ ".$opt_s" = .yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "strip $dsttmp" 1>&2
|
||||
fi
|
||||
strip $dsttmp || exit $?
|
||||
strip $dsttmp || shtool_exit $?
|
||||
fi
|
||||
if [ ".$opt_o" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chown $opt_o $dsttmp" 1>&2
|
||||
fi
|
||||
chown $opt_o $dsttmp || exit $?
|
||||
chown $opt_o $dsttmp || shtool_exit $?
|
||||
fi
|
||||
if [ ".$opt_g" != . ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chgrp $opt_g $dsttmp" 1>&2
|
||||
fi
|
||||
chgrp $opt_g $dsttmp || exit $?
|
||||
chgrp $opt_g $dsttmp || shtool_exit $?
|
||||
fi
|
||||
if [ ".$opt_m" != ".-" ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
echo "chmod $opt_m $dsttmp" 1>&2
|
||||
fi
|
||||
chmod $opt_m $dsttmp || exit $?
|
||||
chmod $opt_m $dsttmp || shtool_exit $?
|
||||
fi
|
||||
|
||||
|
||||
# determine whether to do a quick install
|
||||
# (has to be done _after_ the strip was already done)
|
||||
quick=no
|
||||
@@ -793,7 +870,7 @@ install )
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# finally, install the file to the real destination
|
||||
if [ $quick = yes ]; then
|
||||
if [ ".$opt_t" = .yes ]; then
|
||||
@@ -807,21 +884,21 @@ install )
|
||||
rm -f $dst && mv $dsttmp $dst
|
||||
fi
|
||||
done
|
||||
|
||||
shtool_exit 0
|
||||
;;
|
||||
|
||||
mkdir )
|
||||
##
|
||||
## mkdir -- Make one or more directories
|
||||
## Copyright (c) 1996-2002 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
## Cleaned up and enhanced for shtool
|
||||
## Copyright (c) 1996-2005 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
|
||||
|
||||
errstatus=0
|
||||
for p in ${1+"$@"}; do
|
||||
# if the directory already exists...
|
||||
if [ -d "$p" ]; then
|
||||
if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
|
||||
if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
|
||||
echo "$msgprefix:Error: directory already exists: $p" 1>&2
|
||||
errstatus=1
|
||||
break
|
||||
@@ -895,32 +972,32 @@ mkdir )
|
||||
done
|
||||
fi
|
||||
done
|
||||
exit $errstatus
|
||||
|
||||
shtool_exit $errstatus
|
||||
;;
|
||||
|
||||
path )
|
||||
##
|
||||
## path -- Deal with program paths
|
||||
## Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
|
||||
## Originally written for Apache
|
||||
## Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
|
||||
##
|
||||
|
||||
|
||||
namelist="$*"
|
||||
|
||||
|
||||
# check whether the test command supports the -x option
|
||||
if [ -x /bin/sh ] 2>/dev/null; then
|
||||
minusx="-x"
|
||||
else
|
||||
minusx="-r"
|
||||
fi
|
||||
|
||||
|
||||
# split path string
|
||||
paths="`echo $opt_p |\
|
||||
sed -e 's/^:/.:/' \
|
||||
-e 's/::/:.:/g' \
|
||||
-e 's/:$/:./' \
|
||||
-e 's/:/ /g'`"
|
||||
|
||||
|
||||
# SPECIAL REQUEST
|
||||
# translate forward to reverse path
|
||||
if [ ".$opt_r" = .yes ]; then
|
||||
@@ -933,25 +1010,25 @@ path )
|
||||
done
|
||||
fi
|
||||
echo $rp | sed -e 's:/$::'
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
|
||||
|
||||
# SPECIAL REQUEST
|
||||
# strip out directory or base name
|
||||
if [ ".$opt_d" = .yes ]; then
|
||||
echo "$namelist" |\
|
||||
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;'
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
if [ ".$opt_b" = .yes ]; then
|
||||
echo "$namelist" |\
|
||||
sed -e 's;.*/\([^/]*\)$;\1;'
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
|
||||
|
||||
# MAGIC SITUATION
|
||||
# Perl Interpreter (perl)
|
||||
if [ ".$opt_m" = .yes -a ".$namelist" = .perl ]; then
|
||||
if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
touch $tmpfile
|
||||
found=0
|
||||
@@ -960,7 +1037,7 @@ path )
|
||||
dir=`echo $dir | sed -e 's;/*$;;'`
|
||||
nc=99
|
||||
for name in perl perl5 miniperl; do
|
||||
if [ $minusx "$dir/$name" -a ! -d "$dir/$name" ]; then
|
||||
if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then
|
||||
perl="$dir/$name"
|
||||
pv=`$perl -e 'printf("%.3f", $]);'`
|
||||
echo "$pv:$pc:$nc:$perl" >>$tmpfile
|
||||
@@ -974,15 +1051,15 @@ path )
|
||||
perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`"
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
echo "$perl"
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
rm -f $tmpfile >/dev/null 2>&1
|
||||
exit 1
|
||||
shtool_exit 1
|
||||
fi
|
||||
|
||||
|
||||
# MAGIC SITUATION
|
||||
# C pre-processor (cpp)
|
||||
if [ ".$opt_m" = .yes -a ".$namelist" = .cpp ]; then
|
||||
if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then
|
||||
echo >$tmpfile.c "#include <assert.h>"
|
||||
echo >>$tmpfile.c "Syntax Error"
|
||||
# 1. try the standard cc -E approach
|
||||
@@ -998,7 +1075,7 @@ path )
|
||||
# 3. try a standalone cpp command in path and lib dirs
|
||||
for path in $paths /lib /usr/lib /usr/local/lib; do
|
||||
path=`echo $path | sed -e 's;/*$;;'`
|
||||
if [ $minusx "$path/cpp" -a ! -d "$path/cpp" ]; then
|
||||
if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then
|
||||
cpp="$path/cpp"
|
||||
break
|
||||
fi
|
||||
@@ -1017,30 +1094,30 @@ path )
|
||||
rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1
|
||||
if [ ".$cpp" != . ]; then
|
||||
echo "$cpp"
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
exit 1
|
||||
shtool_exit 1
|
||||
fi
|
||||
|
||||
|
||||
# STANDARD SITUATION
|
||||
# iterate over names
|
||||
for name in $namelist; do
|
||||
# iterate over paths
|
||||
for path in $paths; do
|
||||
path=`echo $path | sed -e 's;/*$;;'`
|
||||
if [ $minusx "$path/$name" -a ! -d "$path/$name" ]; then
|
||||
if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then
|
||||
if [ ".$opt_s" != .yes ]; then
|
||||
echo "$path/$name"
|
||||
fi
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit 1
|
||||
|
||||
shtool_exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
exit 0
|
||||
shtool_exit 0
|
||||
|
||||
##EOF##
|
||||
+48
-15
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=0
|
||||
RELEASE_VERSION=4
|
||||
EXTRA_VERSION=""
|
||||
RELEASE_VERSION=5
|
||||
EXTRA_VERSION="RC2"
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
@@ -180,6 +180,17 @@ PHP_C_BIGENDIAN
|
||||
dnl Platform-specific compile settings.
|
||||
dnl -------------------------------------------------------------------------
|
||||
|
||||
dnl See bug #28605
|
||||
case $host_cpu in
|
||||
alpha*)
|
||||
if test "$GCC" = "yes"; then
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
else
|
||||
CFLAGS="$CFLAGS -ieee"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $host_alias in
|
||||
*solaris*)
|
||||
CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
||||
@@ -204,12 +215,13 @@ case $host_alias in
|
||||
fi
|
||||
;;
|
||||
*netware*)
|
||||
PHP_OS="NetWare"
|
||||
PHP_UNAME="NetWare"
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
|
||||
PHP_BUILD_PROGRAM
|
||||
PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS,php)
|
||||
PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS)
|
||||
PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS)
|
||||
PHP5LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\)
|
||||
EXTENSION_DIR=sys:/php$MAJOR_VERSION/ext
|
||||
PHP_SUBST(PHP5LIB_SHARED_LIBADD)
|
||||
PHP_SHARED_MODULE(php5lib, PHP_GLOBAL_OBJS, netware)
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -402,8 +414,7 @@ unix.h \
|
||||
utime.h \
|
||||
sys/utsname.h \
|
||||
sys/ipc.h \
|
||||
dlfcn.h \
|
||||
inttypes.h
|
||||
dlfcn.h
|
||||
],[],[],[
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@@ -1103,10 +1114,20 @@ EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS"
|
||||
|
||||
PHP_BUILD_DATE=`date '+%Y-%m-%d'`
|
||||
AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
|
||||
PHP_UNAME=`uname -a | xargs`
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
|
||||
PHP_OS=`uname | xargs`
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
|
||||
case $host_alias in
|
||||
*netware*)
|
||||
PHP_OS="NetWare"
|
||||
PHP_UNAME="NetWare"
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host])
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host])
|
||||
;;
|
||||
*)
|
||||
PHP_UNAME=`uname -a | xargs`
|
||||
AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
|
||||
PHP_OS=`uname | xargs`
|
||||
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$PHP_SAPI_CLI" != "no"; then
|
||||
PHP_CLI_TARGET="\$(SAPI_CLI_PATH)"
|
||||
@@ -1143,6 +1164,7 @@ PHP_SUBST(datadir)
|
||||
PHP_SUBST(sysconfdir)
|
||||
|
||||
PHP_SUBST(AWK)
|
||||
PHP_SUBST(EXEEXT)
|
||||
PHP_SUBST(CC)
|
||||
PHP_SUBST(CFLAGS)
|
||||
PHP_SUBST(CFLAGS_CLEAN)
|
||||
@@ -1268,7 +1290,16 @@ PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \
|
||||
plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c)
|
||||
|
||||
PHP_ADD_SOURCES(/main, internal_functions.c,, sapi)
|
||||
PHP_ADD_SOURCES(/main, internal_functions_cli.c,, cli)
|
||||
|
||||
case $host_alias in
|
||||
*netware*)
|
||||
PHP_ADD_BUILD_DIR(win32)
|
||||
PHP_ADD_BUILD_DIR(netware)
|
||||
;;
|
||||
*)
|
||||
PHP_ADD_SOURCES(/main, internal_functions_cli.c,, cli)
|
||||
;;
|
||||
esac
|
||||
|
||||
PHP_ADD_SOURCES(/Zend, zend_language_parser.c zend_language_scanner.c \
|
||||
zend_ini_parser.c zend_ini_scanner.c)
|
||||
@@ -1313,9 +1344,11 @@ AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
|
||||
|
||||
$php_shtool mkdir -p pear/scripts
|
||||
$php_shtool mkdir -p scripts
|
||||
$php_shtool mkdir -p scripts/man1
|
||||
|
||||
ALL_OUTPUT_FILES="php5.spec main/build-defs.h \
|
||||
scripts/phpize scripts/php-config \
|
||||
scripts/phpize scripts/man1/phpize.1 \
|
||||
scripts/php-config scripts/man1/php-config.1 \
|
||||
$PHP_OUTPUT_FILES"
|
||||
|
||||
AC_OUTPUT($ALL_OUTPUT_FILES, [], [
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#if PHP_WIN32
|
||||
#include "../../../../main/config.w32.h"
|
||||
#elif defined(NETWARE)
|
||||
#include "config.nw.h"
|
||||
#else
|
||||
#include <php_config.h>
|
||||
#endif
|
||||
|
||||
+35
-45
@@ -40,9 +40,6 @@
|
||||
#define PHP_BZ_ERRSTR 1
|
||||
#define PHP_BZ_ERRBOTH 2
|
||||
|
||||
/* Blocksize of the decompression buffer */
|
||||
#define PHP_BZ_DECOMPRESS_SIZE 4096
|
||||
|
||||
function_entry bz2_functions[] = {
|
||||
PHP_FE(bzopen, NULL)
|
||||
PHP_FE(bzread, NULL)
|
||||
@@ -438,56 +435,49 @@ PHP_FUNCTION(bzcompress)
|
||||
Decompresses BZip2 compressed data */
|
||||
PHP_FUNCTION(bzdecompress)
|
||||
{
|
||||
zval **source, /* Source data to decompress */
|
||||
**zsmall; /* (Optional) user specified small */
|
||||
char *dest; /* Destination buffer, initially allocated */
|
||||
int error, /* Error container */
|
||||
iter = 1, /* Iteration count for the compression loop */
|
||||
size, /* Current size to realloc the dest buffer to */
|
||||
dest_len = PHP_BZ_DECOMPRESS_SIZE, /* Size of the destination length */
|
||||
small = 0, /* The actual small */
|
||||
argc = ZEND_NUM_ARGS(); /* Argument count */
|
||||
|
||||
if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &source, &zsmall) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
char *source, *dest;
|
||||
int source_len, error;
|
||||
long small = 0;
|
||||
unsigned long long size = 0;
|
||||
bz_stream bzs;
|
||||
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
convert_to_string_ex(source);
|
||||
|
||||
/* optional small argument handling */
|
||||
if (argc > 1) {
|
||||
convert_to_long_ex(zsmall);
|
||||
small = Z_LVAL_PP(zsmall);
|
||||
bzs.bzalloc = NULL;
|
||||
bzs.bzfree = NULL;
|
||||
|
||||
if (BZ2_bzDecompressInit(&bzs, 0, small) != BZ_OK) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Depending on the size of the source buffer, either allocate
|
||||
the length of the source buffer or the a default decompression
|
||||
size */
|
||||
dest = emalloc(PHP_BZ_DECOMPRESS_SIZE > Z_STRLEN_PP(source) ? PHP_BZ_DECOMPRESS_SIZE : Z_STRLEN_PP(source));
|
||||
bzs.next_in = source;
|
||||
bzs.avail_in = source_len;
|
||||
|
||||
/* (de)Compression Loop */
|
||||
do {
|
||||
/* Handle the (re)allocation of the buffer */
|
||||
size = dest_len * iter;
|
||||
if (iter > 1) {
|
||||
dest = erealloc(dest, size);
|
||||
}
|
||||
++iter;
|
||||
|
||||
/* Perform the decompression */
|
||||
error = BZ2_bzBuffToBuffDecompress(dest, &size, Z_STRVAL_PP(source), Z_STRLEN_PP(source), small, 0);
|
||||
} while (error == BZ_OUTBUFF_FULL);
|
||||
/* in most cases bz2 offers at least 2:1 compression, so we use that as our base */
|
||||
bzs.avail_out = source_len * 2;
|
||||
bzs.next_out = dest = emalloc(bzs.avail_out + 1);
|
||||
|
||||
if (error != BZ_OK) {
|
||||
efree(dest);
|
||||
RETURN_LONG(error);
|
||||
} else {
|
||||
/* we might have allocated a little to much, so erealloc the buffer
|
||||
down to size, before returning it */
|
||||
while ((error = BZ2_bzDecompress(&bzs)) == BZ_OK && bzs.avail_in > 0) {
|
||||
/* compression is better then 2:1, need to allocate more memory */
|
||||
bzs.avail_out = source_len;
|
||||
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
|
||||
dest = erealloc(dest, size + bzs.avail_out + 1);
|
||||
bzs.next_out = dest + size;
|
||||
}
|
||||
|
||||
if (error == BZ_STREAM_END || error == BZ_OK) {
|
||||
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
|
||||
dest = erealloc(dest, size + 1);
|
||||
dest[size] = 0;
|
||||
RETURN_STRINGL(dest, size, 0);
|
||||
dest[size] = '\0';
|
||||
RETVAL_STRINGL(dest, size, 0);
|
||||
} else { /* real error */
|
||||
efree(dest);
|
||||
RETVAL_LONG(error);
|
||||
}
|
||||
|
||||
BZ2_bzDecompressEnd(&bzs);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+11
-19
@@ -246,6 +246,11 @@ PHP_FUNCTION(cal_days_in_month)
|
||||
|
||||
sdn_start = calendar->to_jd(year, month, 1);
|
||||
|
||||
if (sdn_start == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid date.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
sdn_next = calendar->to_jd(year, 1 + month, 1);
|
||||
|
||||
if (sdn_next == 0) {
|
||||
@@ -261,7 +266,7 @@ PHP_FUNCTION(cal_days_in_month)
|
||||
Converts from a supported calendar to Julian Day Count */
|
||||
PHP_FUNCTION(cal_to_jd)
|
||||
{
|
||||
long cal, month, day, year, jdate;
|
||||
long cal, month, day, year;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
@@ -272,8 +277,7 @@ PHP_FUNCTION(cal_to_jd)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
jdate = cal_conversion_table[cal].to_jd(year, month, day);
|
||||
RETURN_LONG(jdate);
|
||||
RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -342,15 +346,12 @@ PHP_FUNCTION(jdtogregorian)
|
||||
PHP_FUNCTION(gregoriantojd)
|
||||
{
|
||||
long year, month, day;
|
||||
int jdate;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
jdate = GregorianToSdn(year, month, day);
|
||||
|
||||
RETURN_LONG(jdate);
|
||||
RETURN_LONG(GregorianToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -378,15 +379,12 @@ PHP_FUNCTION(jdtojulian)
|
||||
PHP_FUNCTION(juliantojd)
|
||||
{
|
||||
long year, month, day;
|
||||
int jdate;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
jdate = JulianToSdn(year, month, day);
|
||||
|
||||
RETURN_LONG(jdate);
|
||||
RETURN_LONG(JulianToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -529,15 +527,12 @@ PHP_FUNCTION(jdtojewish)
|
||||
PHP_FUNCTION(jewishtojd)
|
||||
{
|
||||
long year, month, day;
|
||||
int jdate;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
jdate = JewishToSdn(year, month, day);
|
||||
|
||||
RETURN_LONG(jdate);
|
||||
RETURN_LONG(JewishToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -565,15 +560,12 @@ PHP_FUNCTION(jdtofrench)
|
||||
PHP_FUNCTION(frenchtojd)
|
||||
{
|
||||
long year, month, day;
|
||||
int jdate;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
jdate = FrenchToSdn(year, month, day);
|
||||
|
||||
RETURN_LONG(jdate);
|
||||
RETURN_LONG(FrenchToSdn(year, month, day));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
|
||||
|
||||
default:
|
||||
desc = php_win_err(hr);
|
||||
spprintf(&msg, 0, "Error %s", desc);
|
||||
spprintf(&msg, 0, "Error [0x%08x] %s", hr, desc);
|
||||
LocalFree(desc);
|
||||
break;
|
||||
}
|
||||
@@ -620,7 +620,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||
efree(vargs);
|
||||
}
|
||||
|
||||
/* a bit strange this, but... */
|
||||
/* a bit of a hack this, but it's needed for COM array access. */
|
||||
if (hr == DISP_E_BADPARAMCOUNT)
|
||||
return hr;
|
||||
|
||||
|
||||
@@ -194,12 +194,12 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||
INIT_CLASS_ENTRY(ce, "com_exception", NULL);
|
||||
php_com_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
|
||||
php_com_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
// php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
/* php_com_exception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "com_safearray_proxy", NULL);
|
||||
php_com_saproxy_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
|
||||
php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
// php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
/* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */
|
||||
php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get;
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "variant", NULL);
|
||||
|
||||
@@ -49,7 +49,7 @@ static zval *com_property_read(zval *object, zval *member, int type TSRMLS_DC)
|
||||
convert_to_string_ex(&member);
|
||||
|
||||
res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
|
||||
DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC);
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
|
||||
@@ -84,30 +84,6 @@ static void com_property_write(zval *object, zval *member, zval *value TSRMLS_DC
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT com_get_default_binding(php_com_dotnet_object *obj TSRMLS_DC)
|
||||
{
|
||||
VARDESC *vardesc;
|
||||
int i;
|
||||
|
||||
if (!obj->typeinfo) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (i = 0; !obj->have_default_bind; i++) {
|
||||
if (FAILED(ITypeInfo_GetVarDesc(obj->typeinfo, i, &vardesc))) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (vardesc->wVarFlags & VARFLAG_FDEFAULTBIND) {
|
||||
obj->default_bind = (DISPID)vardesc->memid;
|
||||
obj->have_default_bind = 1;
|
||||
}
|
||||
|
||||
ITypeInfo_ReleaseVarDesc(obj->typeinfo, vardesc);
|
||||
}
|
||||
return obj->have_default_bind ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
{
|
||||
zval *return_value;
|
||||
@@ -122,14 +98,9 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "this COM object has no default property" TSRMLS_CC);
|
||||
return return_value;
|
||||
}
|
||||
|
||||
VariantInit(&v);
|
||||
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, obj->default_bind,
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset TSRMLS_CC)) {
|
||||
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
|
||||
VariantClear(&v);
|
||||
@@ -163,17 +134,12 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) {
|
||||
php_com_throw_exception(E_INVALIDARG, "this COM object has no default property" TSRMLS_CC);
|
||||
return;
|
||||
}
|
||||
|
||||
args[0] = offset;
|
||||
args[1] = value;
|
||||
|
||||
VariantInit(&v);
|
||||
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, obj->default_bind,
|
||||
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args TSRMLS_CC)) {
|
||||
VariantClear(&v);
|
||||
}
|
||||
@@ -524,23 +490,19 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
|
||||
php_com_dotnet_object *obj;
|
||||
VARIANT v;
|
||||
VARTYPE vt = VT_EMPTY;
|
||||
zval free_obj;
|
||||
HRESULT res = S_OK;
|
||||
|
||||
if (should_free) {
|
||||
zval_dtor(writeobj);
|
||||
free_obj = *writeobj;
|
||||
}
|
||||
|
||||
ZVAL_NULL(writeobj);
|
||||
|
||||
obj = CDNO_FETCH(readobj);
|
||||
ZVAL_NULL(writeobj);
|
||||
VariantInit(&v);
|
||||
|
||||
if (V_VT(&obj->v) == VT_DISPATCH) {
|
||||
|
||||
if (!obj->have_default_bind && !com_get_default_binding(obj TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (FAILURE == php_com_do_invoke_by_id(obj, obj->default_bind,
|
||||
if (FAILURE == php_com_do_invoke_by_id(obj, DISPID_VALUE,
|
||||
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -564,12 +526,23 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
|
||||
}
|
||||
|
||||
if (vt != VT_EMPTY) {
|
||||
VariantChangeType(&v, &v, 0, vt);
|
||||
res = VariantChangeType(&v, &v, 0, vt);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
|
||||
}
|
||||
|
||||
php_com_zval_from_variant(writeobj, &v, obj->code_page TSRMLS_CC);
|
||||
VariantClear(&v);
|
||||
return SUCCESS;
|
||||
if (should_free) {
|
||||
zval_dtor(&free_obj);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static int com_object_count(zval *object, long *count TSRMLS_DC)
|
||||
|
||||
@@ -400,6 +400,7 @@ static const struct {
|
||||
{ VT_VOID, "VT_VOID" },
|
||||
{ VT_PTR, "VT_PTR" },
|
||||
{ VT_HRESULT, "VT_HRESULT" },
|
||||
{ VT_SAFEARRAY, "VT_SAFEARRAY" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -37,10 +37,8 @@ typedef struct _php_com_dotnet_object {
|
||||
|
||||
ITypeInfo *typeinfo;
|
||||
long code_page;
|
||||
unsigned int have_default_bind:1;
|
||||
|
||||
zend_class_entry *ce;
|
||||
DISPID default_bind; /* default property for array accesses */
|
||||
|
||||
/* associated event sink */
|
||||
IDispatch *sink_dispatch;
|
||||
|
||||
+20
-6
@@ -484,20 +484,22 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
fci.no_separation = 0;
|
||||
fci.symbol_table = NULL;
|
||||
|
||||
ch->in_callback = 1;
|
||||
error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC);
|
||||
ch->in_callback = 0;
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
|
||||
length = -1;
|
||||
} else {
|
||||
} else if (retval_ptr) {
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
length = Z_LVAL_P(retval_ptr);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(argv[0]);
|
||||
zval_ptr_dtor(argv[1]);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -554,20 +556,22 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
fci.no_separation = 0;
|
||||
fci.symbol_table = NULL;
|
||||
|
||||
ch->in_callback = 1;
|
||||
error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC);
|
||||
ch->in_callback = 0;
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
|
||||
} else {
|
||||
} else if (retval_ptr) {
|
||||
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
length = MIN(size * nmemb, Z_STRLEN_P(retval_ptr));
|
||||
memcpy(data, Z_STRVAL_P(retval_ptr), length);
|
||||
}
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(argv[0]);
|
||||
zval_ptr_dtor(argv[1]);
|
||||
zval_ptr_dtor(argv[2]);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -625,19 +629,21 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
fci.params = argv;
|
||||
fci.no_separation = 0;
|
||||
|
||||
ch->in_callback = 1;
|
||||
error = zend_call_function(&fci, &t->fci_cache TSRMLS_CC);
|
||||
ch->in_callback = 0;
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
|
||||
length = -1;
|
||||
} else {
|
||||
} else if (retval_ptr) {
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
length = Z_LVAL_P(retval_ptr);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
}
|
||||
zval_ptr_dtor(argv[0]);
|
||||
zval_ptr_dtor(argv[1]);
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -773,6 +779,8 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
|
||||
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
|
||||
|
||||
(*ch)->in_callback = 0;
|
||||
|
||||
memset(&(*ch)->err, 0, sizeof((*ch)->err));
|
||||
|
||||
zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (void(*)(void *)) curl_free_string, 0);
|
||||
@@ -1468,6 +1476,12 @@ PHP_FUNCTION(curl_close)
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
|
||||
|
||||
if (ch->in_callback) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close CURL handle from a callback");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch->uses) {
|
||||
ch->uses--;
|
||||
} else {
|
||||
|
||||
@@ -121,6 +121,7 @@ typedef struct {
|
||||
php_curl_handlers *handlers;
|
||||
long id;
|
||||
unsigned int uses;
|
||||
zend_bool in_callback;
|
||||
} php_curl;
|
||||
|
||||
typedef struct {
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ AC_ARG_WITH(db4,
|
||||
break
|
||||
fi
|
||||
done
|
||||
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)])
|
||||
PHP_DBA_DB_CHECK(4, db-4.3 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)
|
||||
|
||||
+5
-1
@@ -10,7 +10,11 @@ if test -z "$PHP_LIBXML_DIR"; then
|
||||
[ --with-libxml-dir[=DIR] DOM: libxml2 install prefix.], no, no)
|
||||
fi
|
||||
|
||||
if test "$PHP_DOM" != "no" && test "$PHP_LIBXML" != "no"; then
|
||||
if test "$PHP_DOM" != "no"; then
|
||||
|
||||
if test "$PHP_LIBXML" = "no"; then
|
||||
AC_MSG_ERROR([DOM extension requires LIBXML extension, add --enable-libxml])
|
||||
fi
|
||||
|
||||
PHP_SETUP_LIBXML(DOM_SHARED_LIBADD, [
|
||||
AC_DEFINE(HAVE_DOM,1,[ ])
|
||||
|
||||
Loaded 100 of 491 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user