mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-08 09:47:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d173e6ba5 | ||
|
|
412fb096fa | ||
|
|
c4c952f023 | ||
|
|
10b2bb1cab | ||
|
|
406847a6cd | ||
|
|
57c5bff123 | ||
|
|
9062b2f967 | ||
|
|
29348ff48b | ||
|
|
2067727a80 | ||
|
|
6fcc1515cb | ||
|
|
08e7f480e1 | ||
|
|
f521b61ce2 | ||
|
|
16bc64121f | ||
|
|
d8cd133a33 | ||
|
|
f1ec84159d | ||
|
|
b9a6022f15 | ||
|
|
b832343962 | ||
|
|
8e3e81256f | ||
|
|
24ec8acb2d | ||
|
|
820516e756 | ||
|
|
09d555e3d0 | ||
|
|
9782bbd297 | ||
|
|
833331a53d | ||
|
|
a9b87039e4 | ||
|
|
327125e313 | ||
|
|
ce886edc0b | ||
|
|
bb3e125185 | ||
|
|
f5722d61b4 | ||
|
|
7d77171b9b | ||
|
|
76d520e9a7 | ||
|
|
aa5feff190 | ||
|
|
16dd07c5e0 | ||
|
|
14c1dc4ab4 | ||
|
|
18079dd248 | ||
|
|
ae5598fa85 | ||
|
|
6183a1ed3e | ||
|
|
177647c99b | ||
|
|
278aee14a5 | ||
|
|
29048d8d7e | ||
|
|
e3b65c75be | ||
|
|
a3858e17e9 | ||
|
|
0d27154a49 | ||
|
|
9ab9402ed9 | ||
|
|
db638b91b3 | ||
|
|
c1c1b21686 | ||
|
|
e62db3b3c8 | ||
|
|
f01310928c | ||
|
|
b003591f19 | ||
|
|
9ae0e91ef4 | ||
|
|
c2c1590d52 | ||
|
|
39916670cc | ||
|
|
14b2c4a1f4 | ||
|
|
2074b6ceee | ||
|
|
120ea84394 | ||
|
|
4ca31d911f | ||
|
|
03a1a3675a | ||
|
|
7052ece4e8 | ||
|
|
f34dafccdb | ||
|
|
65052194b4 | ||
|
|
88d0d5427e | ||
|
|
2c99f0230c | ||
|
|
ea138b85ab | ||
|
|
df93e470cc | ||
|
|
e54698481c | ||
|
|
43004bcaaa | ||
|
|
98c0dd4147 | ||
|
|
85f8b2a830 | ||
|
|
b8c51d4614 | ||
|
|
805fe58a28 | ||
|
|
f5c36b8d9e | ||
|
|
25ab185761 | ||
|
|
e7fcde565b | ||
|
|
6164ea4840 | ||
|
|
470ca9ef6f | ||
|
|
beffd8738e | ||
|
|
bce14e2c6f | ||
|
|
af2ee723dc | ||
|
|
975771b431 | ||
|
|
3f5e121f2b | ||
|
|
a000fe6c06 | ||
|
|
ff8c3d2d67 | ||
|
|
e6df40e831 | ||
|
|
b559075a02 | ||
|
|
1d87b34375 | ||
|
|
942a83b246 | ||
|
|
92689ec8e0 | ||
|
|
dfb664c946 | ||
|
|
8c4eede77d | ||
|
|
4ad82c5ef2 | ||
|
|
ca612d3fc0 | ||
|
|
87fca31a3f | ||
|
|
54b2a4d6a0 | ||
|
|
82a5d700e3 | ||
|
|
982ac8b7a2 | ||
|
|
6aed779dc8 | ||
|
|
69fe08beb2 | ||
|
|
412bae8482 | ||
|
|
27868d1799 | ||
|
|
bb19590b7e | ||
|
|
48dba110e2 | ||
|
|
255f9fc072 | ||
|
|
8f9fa59341 | ||
|
|
872f6e7af8 | ||
|
|
ecca999733 | ||
|
|
38d64188ff | ||
|
|
048aa76cc9 | ||
|
|
5c3249d954 | ||
|
|
b15b80c1b7 | ||
|
|
5facf4becc | ||
|
|
f5ebf71f49 | ||
|
|
7a69f34c69 | ||
|
|
f1b7a88393 | ||
|
|
853d714008 | ||
|
|
077b8f2d25 | ||
|
|
b6bb43ef94 | ||
|
|
6f20f9d285 | ||
|
|
2fb5c4394b | ||
|
|
9ca8a571e9 | ||
|
|
8ee05c9da8 | ||
|
|
a4430a9cfe | ||
|
|
2be03f0d73 | ||
|
|
85fe5f8c34 | ||
|
|
c7f52698c1 | ||
|
|
d775bca68f | ||
|
|
6c763f3721 | ||
|
|
949e461e8f | ||
|
|
59ed068c78 | ||
|
|
d8cd7dac07 | ||
|
|
4945317c28 | ||
|
|
34f4400502 | ||
|
|
259f662488 | ||
|
|
d349734059 | ||
|
|
fa5f20cfce | ||
|
|
435fff2cb1 | ||
|
|
9173e270b0 | ||
|
|
40645cc0a6 | ||
|
|
33e114b37e | ||
|
|
be85bd83e8 | ||
|
|
29099a7470 | ||
|
|
8823289f9f | ||
|
|
78363147b8 | ||
|
|
ac7665fdc2 | ||
|
|
1410d8c0b2 | ||
|
|
5a4158421c | ||
|
|
945115968c | ||
|
|
970f1f9c7f | ||
|
|
65ef16ef31 | ||
|
|
0186acacdb | ||
|
|
bc4a269d3c | ||
|
|
291441a34c | ||
|
|
d8c1e99f02 | ||
|
|
8d0cc271bf | ||
|
|
bbde60d6d2 | ||
|
|
e2b820f0ea | ||
|
|
c970dbb647 | ||
|
|
29c32f04e3 | ||
|
|
00c6777aa1 | ||
|
|
143ae77156 | ||
|
|
87ba25b722 | ||
|
|
dc77b5700c | ||
|
|
0e5c01290d | ||
|
|
ba16543ef5 | ||
|
|
f65e4feda4 | ||
|
|
20181fde3d | ||
|
|
491ed1813e | ||
|
|
caa5dbe679 | ||
|
|
7e6d72f030 | ||
|
|
6ea962c767 | ||
|
|
c87b2d0cee | ||
|
|
c2c31547c2 | ||
|
|
21851b0001 | ||
|
|
bd96cca64f | ||
|
|
02893ad216 | ||
|
|
4f88703159 | ||
|
|
abc62474bf | ||
|
|
3a9754715a | ||
|
|
2f212ab8d5 | ||
|
|
71be1ed5f1 | ||
|
|
1c6896076f | ||
|
|
6a2d265af6 | ||
|
|
6fe9c3735a | ||
|
|
5d43cf4ec4 | ||
|
|
8b3b1eb121 | ||
|
|
836a7b1a88 | ||
|
|
c26edafb17 | ||
|
|
a9bf810ba2 | ||
|
|
a737e92b08 | ||
|
|
54ae55a949 | ||
|
|
5ab53094fa | ||
|
|
aff24aed0d | ||
|
|
b915644ec4 | ||
|
|
28c71a667a | ||
|
|
d45c4f86d3 | ||
|
|
8060534f63 | ||
|
|
80bdf7eae5 | ||
|
|
2dad2b3882 | ||
|
|
aa0a80bea8 | ||
|
|
dec171c4bf | ||
|
|
6d5779844f | ||
|
|
94ed0368b9 | ||
|
|
6c8d9c8c8e | ||
|
|
9de0be49d6 | ||
|
|
5a76218edd | ||
|
|
d84c321376 | ||
|
|
b3262ff512 | ||
|
|
a825563c0b | ||
|
|
da476e0da9 | ||
|
|
46107c39a4 | ||
|
|
a263d88c81 | ||
|
|
9158cd2494 | ||
|
|
2e98f2dd1a | ||
|
|
902b4bda6a | ||
|
|
87b52bb5cd | ||
|
|
e6199b5279 | ||
|
|
e7f995106c | ||
|
|
3bcb1f3af1 | ||
|
|
13a652c81c | ||
|
|
5ddd062e36 | ||
|
|
4bedc6bb31 | ||
|
|
70f94e52ea | ||
|
|
87c3363fa9 | ||
|
|
ca1dc06e04 | ||
|
|
b5ed0a1d3d | ||
|
|
19c8eeb4e8 | ||
|
|
293e62c99d | ||
|
|
2da7dd5982 | ||
|
|
6325b1b630 | ||
|
|
9244e0eee1 | ||
|
|
712d951ffc | ||
|
|
40773632e0 | ||
|
|
88628a2319 | ||
|
|
31120ba5f7 | ||
|
|
75276870db | ||
|
|
fc0b122460 | ||
|
|
d976c362ac | ||
|
|
6c82c26884 | ||
|
|
a0ef3e1865 | ||
|
|
4f91645642 | ||
|
|
46b2bef868 | ||
|
|
26319ee1a1 | ||
|
|
42a8242676 | ||
|
|
57ab773c70 | ||
|
|
219364ee55 | ||
|
|
8b5fc29c7a | ||
|
|
21f4b69b2b | ||
|
|
f76ce400eb | ||
|
|
16204148bb | ||
|
|
1f2d017ae1 | ||
|
|
1b10ad424a | ||
|
|
3e65f6bf57 | ||
|
|
f84d03b2bc | ||
|
|
2db28891e4 | ||
|
|
7adc26fd8b | ||
|
|
fe80df5446 | ||
|
|
8588815ef3 | ||
|
|
a70fc67b0b | ||
|
|
b5c53ae6c7 | ||
|
|
3d018fb061 | ||
|
|
3845e2c145 | ||
|
|
1930c2c33b | ||
|
|
1e2b92b517 | ||
|
|
983fa5a21e | ||
|
|
3ecbb5c314 | ||
|
|
8fa1628958 | ||
|
|
e52b580cad | ||
|
|
4b28e0a8f1 | ||
|
|
91f5ceb3be | ||
|
|
603758b484 | ||
|
|
b6b575c1d5 | ||
|
|
e2f3142c78 | ||
|
|
7623887079 | ||
|
|
1bd6ec4c91 | ||
|
|
33a6aefce8 | ||
|
|
d3f8aaecd8 | ||
|
|
049cca1711 | ||
|
|
a40df45348 | ||
|
|
8f42eaae01 | ||
|
|
ebeefd9f7d | ||
|
|
646f9a4a8b | ||
|
|
b4fa1661af | ||
|
|
ba3c63dbc9 | ||
|
|
350535d498 | ||
|
|
467caa4307 | ||
|
|
01b6956d61 | ||
|
|
61c3a669b4 | ||
|
|
befb6e9b80 | ||
|
|
35e43dabe1 | ||
|
|
b905779950 | ||
|
|
04c32887f1 | ||
|
|
e0a39d68d8 | ||
|
|
92ec8541c1 | ||
|
|
82a7ef78f3 | ||
|
|
236c42c14e | ||
|
|
b8fdc56a8b | ||
|
|
17ad61bd7f | ||
|
|
ec1507ea9d | ||
|
|
69bd1f31fd | ||
|
|
b9d4af72e9 | ||
|
|
fbbc036830 | ||
|
|
c2b0fdd647 | ||
|
|
3706b626fe | ||
|
|
edbfc48fdd | ||
|
|
59c6886c65 | ||
|
|
8091552925 |
No files matched your search
+2
-2
@@ -220,7 +220,7 @@ COMMENT: Using the new OCI8 driver is encouraged where possible.
|
||||
EXTENSION: dom
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>, Marcus Boerger <helly@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: simplexml
|
||||
@@ -247,7 +247,7 @@ STATUS: Experimental
|
||||
EXTENSION: xsl
|
||||
PRIMARY MAINTAINER: Christian Stocker <chregu@php.net>, Rob Richards <rrichards@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Experimental
|
||||
STATUS: Working
|
||||
SINCE: 5.0
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,119 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2004, PHP 5.0.1
|
||||
23 Sep 2004, PHP 5.0.2
|
||||
- Added new boolean (fourth) parameter to array_slice() that turns on the
|
||||
preservation of keys in the returned array. (Derick)
|
||||
- Added the sorting flag SORT_LOCALE_STRING to the sort() functions which makes
|
||||
them sort based on the current locale. (Derick)
|
||||
- Added interface_exists() and make class_exists() only return true for real
|
||||
classes. (Andrey)
|
||||
- Added PHP_EOL constant that contains the OS way of representing newlines.
|
||||
(Paul Hudson, Derick)
|
||||
- Implemented periodic PCRE compiled regexp cache cleanup, to avoid memory
|
||||
exhaustion. (Andrei)
|
||||
- Renamed SoapClient->__call() to SoapClinet->__soapCall(). (Dmitry)
|
||||
- Fixed bug with raw_post_data not getting set (Brian)
|
||||
- Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev)
|
||||
- Fixed bug #30209 (ReflectionClass::getMethod() lowercases attribute).
|
||||
(Marcus)
|
||||
- Fixed bug #30182 (SOAP module processing WSDL file dumps core). (Dmitry)
|
||||
- Fixed bug #30045 (Cannot pass big integers (> 2147483647) in SOAP requests).
|
||||
(Dmitry)
|
||||
- Fixed bug #29985 (unserialize()/ __PHP_Incomplete_class does not report
|
||||
correctly class name). (Marcus, Tony)
|
||||
- Fixed bug #29945 (simplexml_load_file URL limitation 255 char). (Rob)
|
||||
- Fixed bug #29873 (No defines around pcntl_*priority definitions). (Derick)
|
||||
- Fixed bug #29844 (SOAP doesn't return the result of a valid SOAP request).
|
||||
(Dmitry)
|
||||
- Fixed bug #29842 (soapclient return null value). (Dmitry)
|
||||
- Fixed bug #29839 (incorrect convert (xml:lang to lang)). (Dmitry)
|
||||
- Fixed bug #29830 (SoapServer::setClass() should not export non-public
|
||||
methods). (Dmitry)
|
||||
- Fixed bug #29828 (Interfaces no longer work). (Marcus)
|
||||
- Fixed bug #29821 (Fixed possible crashes in convert_uudecode() on invalid
|
||||
data). (Ilia)
|
||||
- Fixed bug #29808 (array_count_values() breaks with numeric strings). (Ilia)
|
||||
- Fixed bug #29805 (HTTP Authentication Issues). (Uwe Schindler)
|
||||
- Fixed bug #29795 (SegFault with Soap and Amazon's Web Services). (Dmitry)
|
||||
- Fixed bug #29737 (ip2long should return -1 if IP is 255.255.255.255 and FALSE
|
||||
on error). (Tony)
|
||||
- Fixed bug #29711 (Changed ext/xml to default to UTF-8 output). (Rob)
|
||||
- Fixed bug #29678 (opendir() with ftp:// wrapper segfaults if path does not
|
||||
have trailing slash). (Ilia)
|
||||
- Fixed bug #29657 (xml_* functions throw non descriptive error).
|
||||
(Christian, Rob)
|
||||
- Fixed bug #29656 (segfault on result and statement properties). (Georg)
|
||||
- Fixed bug #29566 (foreach/string handling strangeness (crash)). (Dmitry)
|
||||
- Fixed bug #29447 (Reflection API issues). (Marcus)
|
||||
- Fixed bug #29296 (Added sslv2 and sslv3 transports). (Wez)
|
||||
- Fixed bug #29283 (Invalid statement handle in mysqli on execute). (Georg)
|
||||
- Fixed bug #29913 (parse_url() is now binary safe). (Ilia)
|
||||
- Fixed bug #27994 (segfault with Soapserver when WSDL-Cache is enabled).
|
||||
(Dmitry)
|
||||
- Fixed bug #27791 (Apache 2.0 SAPI build against Apache 2 HEAD). (Joe Orton,
|
||||
Derick)
|
||||
- Fixed bug #26737 (private/protected properties not serialized when user
|
||||
declared method __sleep() exists). E_NOTICE thrown when __sleep() returns
|
||||
name of non-existing member. (Andrey, Curt)
|
||||
|
||||
12 Aug 2004, PHP 5.0.1
|
||||
- Changed destructor mechanism so that destructors are called prior to request
|
||||
shutdown. (Marcus)
|
||||
- Rewritten UNIX and Windows install help files. (Documentation Team)
|
||||
- Updated several libraries bundled with the windows release which now
|
||||
includes libxml2-2.6.11, libxslt-1.1.7 and iconv-1.9.1. (Rob, Edin)
|
||||
- Improved and moved ActiveScript SAPI to PECL. (Wez)
|
||||
- Fixed bug #29606 (php_strip_whitespace() prints to stdout rather then
|
||||
returning the value). (Ilia)
|
||||
- Fixed bug #29577 (MYSQLI_CLIENT_FOUND_ROWS undefined) (Georg)
|
||||
- Fixed bug #29573 (Segmentation fault, when exception thrown within
|
||||
PHP function called from XSLT). (Christian)
|
||||
- Fixed bug #29522 (accessing properties without connection) (Georg)
|
||||
- Fixed bug #29505 (get_class_vars() severely broken when used with arrays).
|
||||
(Marcus)
|
||||
- Fixed bug #29490 (.Net object instantiation failed). (Michael Sisolak).
|
||||
- Fixed bug #29474 (win32: usleep() doesn't work). (Wez)
|
||||
- Fixed bug #29449 (win32: feof() hangs on empty tcp stream). (Wez)
|
||||
- Fixed bug #29437 (Possible crash inside array_walk_recursive()). (Ilia)
|
||||
- Fixed bug #29431 (crash when parsing invalid address; invalid address
|
||||
returned by stream_socket_recvfrom(), stream_socket_getname()). (Wez)
|
||||
- Fixed bug #29409 (Segfault in PHP functions called from XSLT). (Rob)
|
||||
- Fixed unloading of dynamically loaded extensions.
|
||||
(Marcus, kameshj at fastmail dot fm)
|
||||
- Fixed bug #29395 (sqlite_escape_string() returns bogus data on empty
|
||||
strings). (Ilia, Tony)
|
||||
- Fixed bug #29392 (com_dotnet crashes when echo'ing an object). (Wez)
|
||||
- Fixed bug #29368 (The destructor is called when an exception is thrown from
|
||||
the constructor). (Marcus)
|
||||
- Fixed bug #29354 (Exception constructor marked as both public and protected).
|
||||
(Marcus)
|
||||
- Fixed bug #29342 (strtotime() does not handle empty date string properly).
|
||||
(Ilia)
|
||||
- Fixed bug #29340 (win32 build produces invalid php_ifx.dll). (Edin)
|
||||
- Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
|
||||
- Fixed bug #29291 (get_class_vars() return names with NULLs). (Marcus)
|
||||
- Fixed bug #29264 (gettext extension not working). (Edin)
|
||||
- Fixed bug #29258 (variant_date_from_timestamp() does not honour
|
||||
timezone). (Wez)
|
||||
- Fixed bug #29256 (error when sending large packets on a socket). (Dmitry)
|
||||
- Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry)
|
||||
- Fixed bug #29147 (Compile Error in mnoGoSearch functions). (Sergey, Antony)
|
||||
- Fixed bug #29132 ($_SERVER["PHP_AUTH_USER"] isn't defined). (Stefan)
|
||||
- Fixed bug #29119 (html_entity_decode() misbehaves with UTF-8). (Moriyoshi)
|
||||
- Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry)
|
||||
- Fixed bug #29061 (soap extension segfaults). (Dmitry)
|
||||
- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
|
||||
- Fixed bug #28969 (Wrong data encoding of special characters). (Dmitry)
|
||||
- Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
|
||||
- Fixed bug #28829 (Thread-unsafety in bcmath elementary values). (Sara)
|
||||
- Fixed bug #28464 (catch() does not catch exceptions by interfaces). (Marcus)
|
||||
- Fixed bug #27669 (PHP 5 didn't support all possibilities for calling static
|
||||
methods dynamically). (Dmitry)
|
||||
- Fixed ReflectionClass::getMethod() and ReflectionClass::getProperty() to
|
||||
raise an ReflectionException instead of returning NULL on failure.
|
||||
(Sebastian)
|
||||
- Fixed convert.* filters to consume remaining buckets_in on flush. (Sara)
|
||||
- Fixed bug in mysqli->client_version. (Georg)
|
||||
|
||||
13 Jul 2004, PHP 5.0.0
|
||||
- Updated PCRE to provide better error handling in certain cases. (Andrei)
|
||||
@@ -10,7 +122,6 @@ PHP NEWS
|
||||
- Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
|
||||
(Ilia)
|
||||
- Fixed bug #28999 (fixed behaviour of exec() to work as it did in 4.X). (Ilia)
|
||||
- Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
|
||||
- Fixed bug #28868 (Internal filter registry not thread safe). (Sara)
|
||||
- Fixed bug #28851 (call_user_func_array has typo in error message). (Marcus)
|
||||
- Fixed bug #28831 (ArrayObject::offsetGet() does the work of offsetUnset()).
|
||||
|
||||
+10
-18
@@ -37,8 +37,11 @@ The next few rules are more of a technical nature.
|
||||
messages every day. Woe be to those who attempt to mess with it.
|
||||
|
||||
2. All news updates intended for public viewing, such as new features,
|
||||
bug fixes, improvements, etc., should go into the NEWS file. Also see
|
||||
the note below about automatically updating NEWS in your commit message.
|
||||
bug fixes, improvements, etc., should go into the NEWS file.
|
||||
|
||||
NB! Lines, starting with @ will go automagically into NEWS file, but
|
||||
this is NOT recommended, though. Please, add news entries directly to
|
||||
NEWS file and don't forget to keep them adjusted and sorted.
|
||||
|
||||
3. Do not commit multiple file and dump all messages in one commit. If you
|
||||
modified several unrelated files, commit each group separately and
|
||||
@@ -59,14 +62,10 @@ The next few rules are more of a technical nature.
|
||||
The format of the commit messages is pretty simple.
|
||||
|
||||
If a line begins with #, it is taken to be a comment and will not appear
|
||||
in the ChangeLog. If the line begins with @, it will be redirected to the
|
||||
NEWS file. Everything else goes into the ChangeLog.
|
||||
in the ChangeLog. Everything else goes into the ChangeLog.
|
||||
|
||||
It is important to note that if your comment or news logline spans multiple
|
||||
lines, you have to put # or @ at the beginning of _every_ such line. Every
|
||||
entry in NEWS has to have a name after it, so if you did it with someone's
|
||||
help, put both your names there. Your name WILL NOT be automatically put
|
||||
at the end of the NEWS entry - so, please provide it yourself.
|
||||
lines, you have to put # at the beginning of _every_ such line.
|
||||
|
||||
Example. Say you modified two files, datetime.c and string.c. In datetime.c
|
||||
you added a new format option for date() function, and in string.c you fixed
|
||||
@@ -78,17 +77,12 @@ For datetime.c:
|
||||
|
||||
(PHP date) Added new 'K' format modifier for printing out number of
|
||||
days until New Year's Eve.
|
||||
@- Added new 'K' format modifier that will output the number of days
|
||||
@ until New Year's Eve. (Bob)
|
||||
|
||||
For string.c:
|
||||
(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
|
||||
# Man, that thing was leaking all over the place!
|
||||
@- Fixed memory leak in trim(). (Bob)
|
||||
|
||||
The lines above marked with @ will go into NEWS file automagically, and the
|
||||
# lines will be omitted from the ChangeLog. Alternatively, you might want
|
||||
to modify NEWS file directly and not use the @ lines.
|
||||
The # lines will be omitted from the ChangeLog automagically.
|
||||
|
||||
If you fix some bugs, you should note the bug ID numbers in your
|
||||
commit message. Bug ID should be prefixed by "#" for easier access to
|
||||
@@ -97,12 +91,10 @@ bug report when developers are browsing CVS via. LXR or Bonsai.
|
||||
Example:
|
||||
|
||||
Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
@ Fixed pgsql notice handler double free crash bug. Bug #14016
|
||||
|
||||
If you don't see your messages in ChangeLog and NEWS right away, don't worry!
|
||||
If you don't see your messages in ChangeLog right away, don't worry!
|
||||
These files are updated once a day, so your stuff will not show up until
|
||||
somewhat later. Don't go adding stuff to NEWS by hand if you already put @
|
||||
lines in the commit message.
|
||||
somewhat later.
|
||||
|
||||
You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
|
||||
to look at PHP CVS repository in various ways.
|
||||
|
||||
@@ -77,20 +77,24 @@
|
||||
|
||||
9. get_class() starting PHP 5 returns the name of the class as it was
|
||||
declared which may lead to problems in older scripts that rely on
|
||||
the previous behaviour - the class name is lowercased.
|
||||
the previous behaviour - the class name is lowercased. Expect the
|
||||
same behaviour from get_parent_class() when applicable.
|
||||
Example :
|
||||
<?php
|
||||
class FooBar {
|
||||
}
|
||||
class ExtFooBar extends FooBar{}
|
||||
$a = new FooBar();
|
||||
var_dump(get_class($a));
|
||||
var_dump(get_class($a), get_parent_class($a));
|
||||
?>
|
||||
|
||||
Output (PHP 4):
|
||||
string(6) "foobar"
|
||||
string(9) "extfoobar"
|
||||
|
||||
Output (PHP 5):
|
||||
string(6) "FooBar"
|
||||
string(9) "ExtFooBar"
|
||||
----------------------------------------------------------------------
|
||||
Example code that will break :
|
||||
//....
|
||||
@@ -101,7 +105,51 @@
|
||||
//...
|
||||
}
|
||||
//...
|
||||
Possible solution is to search for get_class() in all your scripts and
|
||||
use strtolower().
|
||||
Possible solution is to search for get_class() and get_parent_class() in
|
||||
all your scripts and use strtolower().
|
||||
|
||||
10. get_class_methods() returns the names of the methods of a class as they
|
||||
declared. In PHP4 the names are all lowercased.
|
||||
Example code :
|
||||
<?php
|
||||
class Foo{
|
||||
function doFoo(){}
|
||||
function hasFoo(){}
|
||||
}
|
||||
var_dump(get_class_methods("Foo"));
|
||||
?>
|
||||
Output (PHP4):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "dofoo"
|
||||
[1]=>
|
||||
string(6) "hasfoo"
|
||||
}
|
||||
Output (PHP5):
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(5) "doFoo"
|
||||
[1]=>
|
||||
string(6) "hasFoo"
|
||||
}
|
||||
|
||||
11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
|
||||
meaning in class methods and is recognized by the PHP parser. The latter
|
||||
will generate a parse error when assignment to $this is found
|
||||
Example code :
|
||||
<?php
|
||||
class Foo {
|
||||
function assignNew($obj) {
|
||||
$this = $obj;
|
||||
}
|
||||
}
|
||||
$a = new Foo();
|
||||
$b = new Foo();
|
||||
$a->assignNew($b);
|
||||
echo "I was executed\n";
|
||||
?>
|
||||
Output (PHP 4):
|
||||
I was executed
|
||||
Output (PHP 5):
|
||||
PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
|
||||
|
||||
|
||||
+42
-1
@@ -545,7 +545,7 @@ Changes in the Zend Engine 2.0
|
||||
|
||||
<?php
|
||||
class Exception {
|
||||
function __construct(string $message=NULL, int $code=0) {
|
||||
function __construct(/*string*/ $message=NULL, /*int*/ $code=0) {
|
||||
if (func_num_args()) {
|
||||
$this->message = $message;
|
||||
}
|
||||
@@ -890,6 +890,47 @@ Changes in the Zend Engine 2.0
|
||||
the use of all abstract methods declared in the interfaces Iterator
|
||||
and IteratorAggregate respectively.
|
||||
|
||||
* Array overloading
|
||||
|
||||
Objects can be used with Array notation when they implement the
|
||||
interface ArrayAccess. You cannot use such objects in standard
|
||||
array functions, however you have full control over the array
|
||||
notation. This allows lazy initialization or read only array.
|
||||
|
||||
Note that setting [] results in a call to offsetSet() with
|
||||
index being NULL. That means that as with standard arrays you
|
||||
cannot store NULL keys.
|
||||
|
||||
Example:
|
||||
|
||||
<?php
|
||||
class ArrayClass implements ArrayAccess {
|
||||
public $a = array();
|
||||
|
||||
function offsetExists($index) {
|
||||
return array_key_exists($index, $this->a);
|
||||
}
|
||||
function offsetGet($index) {
|
||||
return $this->a[$index];
|
||||
}
|
||||
function offsetSet($index, $newval) {
|
||||
return $this->a[$index] = $newval;
|
||||
}
|
||||
function offsetUnset($index) {
|
||||
unset($this->a[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new ArrayClass;
|
||||
|
||||
$obj[0] = 'bla'; // calls offsetSet(0,'bla')
|
||||
$obj[] = 42; // calls offsetSet(NULL, 42)
|
||||
$x = $obj[0]; // calls offsetGet(0)
|
||||
$b = isset($obj[0]); // calls offsetExists(0)
|
||||
unset($obj[0]); // calls offsetUnset(0)
|
||||
?>
|
||||
|
||||
|
||||
* __METHOD__
|
||||
|
||||
The pseudo constant __METHOD__ shows the current class and method
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #29505 (get_class_vars() severely broken when used with arrays)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public $empty = array();
|
||||
public $three = array(1, "b"=>"c", 3=>array());
|
||||
}
|
||||
|
||||
var_dump(get_class_vars('Test'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
["empty"]=>
|
||||
array(0) {
|
||||
}
|
||||
["three"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
["b"]=>
|
||||
string(1) "c"
|
||||
[3]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
@@ -83,7 +83,6 @@ ZEND_INI_END()
|
||||
ZEND_API int compiler_globals_id;
|
||||
ZEND_API int executor_globals_id;
|
||||
ZEND_API int alloc_globals_id;
|
||||
zend_class_entry global_main_class;
|
||||
HashTable *global_function_table;
|
||||
HashTable *global_class_table;
|
||||
HashTable *global_constants_table;
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@
|
||||
#ifndef ZEND_H
|
||||
#define ZEND_H
|
||||
|
||||
#define ZEND_VERSION "2.0.1-dev"
|
||||
#define ZEND_VERSION "2.0.2"
|
||||
|
||||
#define ZEND_ENGINE_2
|
||||
|
||||
@@ -91,7 +91,7 @@ const char *zend_mh_bundle_error(void);
|
||||
|
||||
#endif /* HAVE_MACH_O_DYLD_H */
|
||||
|
||||
#if defined(HAVE_LIBDL)
|
||||
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
|
||||
|
||||
# ifndef RTLD_LAZY
|
||||
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
|
||||
|
||||
+81
-14
@@ -316,11 +316,13 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
break;
|
||||
case IS_OBJECT: {
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)
|
||||
&& Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
break;
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(arg);
|
||||
if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) {
|
||||
*pl = Z_STRLEN_PP(arg);
|
||||
*p = Z_STRVAL_PP(arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,6 +1218,29 @@ ZEND_API int zend_startup_module(zend_module_entry *module)
|
||||
return zend_register_module_ex(module TSRMLS_CC);
|
||||
}
|
||||
|
||||
void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC)
|
||||
{
|
||||
char lcname[16];
|
||||
int name_len;
|
||||
|
||||
/* we don't care if the function name is longer, in fact lowercasing only
|
||||
* the beginning of the name speeds up the check process */
|
||||
name_len = strlen(fptr->common.function_name);
|
||||
zend_str_tolower_copy(lcname, fptr->common.function_name, MIN(name_len, sizeof(lcname)-1));
|
||||
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
|
||||
|
||||
if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)) && fptr->common.num_args != 0) {
|
||||
zend_error(error_type, "Destuctor %s::%s() cannot take arguments", ce->name, ZEND_DESTRUCTOR_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) && fptr->common.num_args != 0) {
|
||||
zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) && fptr->common.num_args != 1) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && fptr->common.num_args != 2) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME);
|
||||
} else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && fptr->common.num_args != 2) {
|
||||
zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* registers all functions in *library_functions in the function hash */
|
||||
ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC)
|
||||
@@ -1226,9 +1251,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
int count=0, unload=0;
|
||||
HashTable *target_function_table = function_table;
|
||||
int error_type;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL;
|
||||
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__call = NULL;
|
||||
char *lowercase_name;
|
||||
int fname_len;
|
||||
char *lc_class_name;
|
||||
int class_name_len;
|
||||
|
||||
if (type==MODULE_PERSISTENT) {
|
||||
error_type = E_CORE_WARNING;
|
||||
@@ -1240,6 +1267,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
target_function_table = CG(function_table);
|
||||
}
|
||||
internal_function->type = ZEND_INTERNAL_FUNCTION;
|
||||
|
||||
if (scope) {
|
||||
class_name_len = strlen(scope->name);
|
||||
lc_class_name = zend_str_tolower_dup(scope->name, class_name_len);
|
||||
}
|
||||
|
||||
while (ptr->fname) {
|
||||
internal_function->handler = ptr->handler;
|
||||
@@ -1309,18 +1341,28 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
* If it's an old-style constructor, store it only if we don't have
|
||||
* a constructor already.
|
||||
*/
|
||||
if (!strcmp(ptr->fname, scope->name) && !ctor) {
|
||||
if ((fname_len == class_name_len) && !memcmp(lowercase_name, lc_class_name, class_name_len+1) && !ctor) {
|
||||
ctor = reg_function;
|
||||
} else if (!strcmp(ptr->fname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME))) {
|
||||
ctor = reg_function;
|
||||
} else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME))) {
|
||||
dtor = reg_function;
|
||||
if (internal_function->num_args) {
|
||||
zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
|
||||
}
|
||||
|
||||
} else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) {
|
||||
} else if ((fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME))) {
|
||||
clone = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) {
|
||||
__call = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_GET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) {
|
||||
__get = reg_function;
|
||||
} else if ((fname_len == sizeof(ZEND_SET_FUNC_NAME)-1) && !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) {
|
||||
__set = reg_function;
|
||||
} else {
|
||||
reg_function = NULL;
|
||||
}
|
||||
if (reg_function) {
|
||||
zend_check_magic_method_implementation(scope, reg_function, error_type TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
ptr++;
|
||||
@@ -1328,6 +1370,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
free_alloca(lowercase_name);
|
||||
}
|
||||
if (unload) { /* before unloading, display all remaining bad function in the module */
|
||||
if (scope) {
|
||||
efree(lc_class_name);
|
||||
}
|
||||
while (ptr->fname) {
|
||||
if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
|
||||
zend_error(error_type, "Function registration failed - duplicate name - %s", ptr->fname);
|
||||
@@ -1341,27 +1386,49 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
scope->constructor = ctor;
|
||||
scope->destructor = dtor;
|
||||
scope->clone = clone;
|
||||
scope->__call = __call;
|
||||
scope->__get = __get;
|
||||
scope->__set = __set;
|
||||
if (ctor) {
|
||||
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", ctor->common.scope->name, ctor->common.function_name);
|
||||
zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, ctor->common.function_name);
|
||||
}
|
||||
ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (dtor) {
|
||||
dtor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Destructor %s::%s cannot be static", dtor->common.scope->name, dtor->common.function_name);
|
||||
zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name, dtor->common.function_name);
|
||||
}
|
||||
dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (clone) {
|
||||
clone->common.fn_flags |= ZEND_ACC_CLONE;
|
||||
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Constructor %s::%s cannot be static", clone->common.scope->name, clone->common.function_name);
|
||||
zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name, clone->common.function_name);
|
||||
}
|
||||
clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__call) {
|
||||
if (__call->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __call->common.function_name);
|
||||
}
|
||||
__call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__get) {
|
||||
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __get->common.function_name);
|
||||
}
|
||||
__get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
if (__set) {
|
||||
if (__set->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error(error_type, "Method %s::%s() cannot be static", scope->name, __set->common.function_name);
|
||||
}
|
||||
__set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
efree(lc_class_name);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
|
||||
ZEND_API int zend_register_module(zend_module_entry *module_entry);
|
||||
ZEND_API int zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
|
||||
void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC);
|
||||
|
||||
ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC);
|
||||
ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC);
|
||||
|
||||
+1
-1
@@ -481,7 +481,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown TSRMLS_DC)
|
||||
unsigned int i, j;
|
||||
zend_mem_header *ptr;
|
||||
|
||||
for (i=1; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (i=0; i<MAX_CACHED_MEMORY; i++) {
|
||||
for (j=0; j<AG(cache_count)[i]; j++) {
|
||||
ptr = (zend_mem_header *) AG(cache)[i][j];
|
||||
# if MEMORY_LIMIT
|
||||
|
||||
@@ -85,6 +85,10 @@ 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 */
|
||||
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
#define safe_emalloc(nmemb, size, offset) _safe_emalloc((nmemb), (size), (offset) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
|
||||
@@ -123,6 +127,52 @@ ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZE
|
||||
#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))
|
||||
#define efree(ptr) free(ptr)
|
||||
#define ecalloc(nmemb, size) calloc((nmemb), (size))
|
||||
#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))
|
||||
|
||||
/* Relay wrapper macros */
|
||||
#define emalloc_rel(size) malloc(size)
|
||||
#define safe_emalloc_rel(nmemb, size, offset) malloc((nmemb) * (size) + (offset))
|
||||
#define efree_rel(ptr) free(ptr)
|
||||
#define ecalloc_rel(nmemb, size) calloc((nmemb), (size))
|
||||
#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))
|
||||
|
||||
/* Selective persistent/non persistent allocation macros */
|
||||
#define pemalloc(size, persistent) malloc(size)
|
||||
#define pefree(ptr, persistent) free(ptr)
|
||||
#define pecalloc(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#define perealloc(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define perealloc_recoverable(ptr, size, persistent) realloc((ptr), (size))
|
||||
#define pestrdup(s, persistent) strdup(s)
|
||||
|
||||
#define pemalloc_rel(size, persistent) malloc(size)
|
||||
#define pefree_rel(ptr, persistent) free(ptr)
|
||||
#define pecalloc_rel(nmemb, size, persistent) calloc((nmemb), (size))
|
||||
#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)
|
||||
|
||||
#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(empty_string))
|
||||
#define safe_estrndup(ptr, len) ((ptr)?(strndup((ptr), (len))):(empty_string))
|
||||
|
||||
#endif
|
||||
|
||||
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
|
||||
|
||||
ZEND_API void start_memory_manager(TSRMLS_D);
|
||||
|
||||
@@ -44,6 +44,7 @@ static ZEND_FUNCTION(get_class);
|
||||
static ZEND_FUNCTION(get_parent_class);
|
||||
static ZEND_FUNCTION(method_exists);
|
||||
static ZEND_FUNCTION(class_exists);
|
||||
static ZEND_FUNCTION(interface_exists);
|
||||
static ZEND_FUNCTION(function_exists);
|
||||
#if ZEND_DEBUG
|
||||
static ZEND_FUNCTION(leak);
|
||||
@@ -102,6 +103,7 @@ static zend_function_entry builtin_functions[] = {
|
||||
ZEND_FE(get_parent_class, NULL)
|
||||
ZEND_FE(method_exists, NULL)
|
||||
ZEND_FE(class_exists, NULL)
|
||||
ZEND_FE(interface_exists, NULL)
|
||||
ZEND_FE(function_exists, NULL)
|
||||
#if ZEND_DEBUG
|
||||
ZEND_FE(leak, NULL)
|
||||
@@ -661,7 +663,6 @@ ZEND_FUNCTION(get_class_vars)
|
||||
{
|
||||
zval **class_name;
|
||||
zend_class_entry *ce, **pce;
|
||||
zval *tmp;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class_name)==FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
@@ -674,11 +675,41 @@ ZEND_FUNCTION(get_class_vars)
|
||||
} else {
|
||||
ce = *pce;
|
||||
array_init(return_value);
|
||||
if (!ce->constants_updated) {
|
||||
zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
|
||||
ce->constants_updated = 1;
|
||||
|
||||
if (zend_hash_num_elements(&ce->default_properties) > 0) {
|
||||
HashPosition pos;
|
||||
zval **prop;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos);
|
||||
while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) {
|
||||
char *key, *class_name, *prop_name;
|
||||
uint key_len;
|
||||
ulong num_index;
|
||||
zval *prop_copy;
|
||||
|
||||
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
|
||||
zend_hash_move_forward_ex(&ce->default_properties, &pos);
|
||||
zend_unmangle_property_name(key, &class_name, &prop_name);
|
||||
if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
|
||||
/* filter privates from base classes */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy: enforce read only access */
|
||||
ALLOC_ZVAL(prop_copy);
|
||||
*prop_copy = **prop;
|
||||
zval_copy_ctor(prop_copy);
|
||||
INIT_PZVAL(prop_copy);
|
||||
|
||||
/* this is necessary to make it able to work with default array
|
||||
* properties, returned to user */
|
||||
if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || Z_TYPE_P(prop_copy) == IS_CONSTANT) {
|
||||
zval_update_constant(&prop_copy, 0 TSRMLS_CC);
|
||||
}
|
||||
|
||||
add_assoc_zval(return_value, prop_name, prop_copy);
|
||||
}
|
||||
}
|
||||
zend_hash_copy(return_value->value.ht, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -819,11 +850,42 @@ ZEND_FUNCTION(class_exists)
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name);
|
||||
RETURN_BOOL(found == SUCCESS);
|
||||
RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE));
|
||||
}
|
||||
|
||||
if (zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_TRUE;
|
||||
RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) == 0);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool interface_exists(string classname [, bool autoload])
|
||||
Checks if the class exists */
|
||||
ZEND_FUNCTION(interface_exists)
|
||||
{
|
||||
char *iface_name, *lc_name;
|
||||
zend_class_entry **ce;
|
||||
int iface_name_len;
|
||||
zend_bool autoload = 1;
|
||||
int found;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
lc_name = do_alloca(iface_name_len + 1);
|
||||
zend_str_tolower_copy(lc_name, iface_name, iface_name_len);
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, iface_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name);
|
||||
RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE);
|
||||
}
|
||||
|
||||
if (zend_lookup_class(iface_name, iface_name_len, &ce TSRMLS_CC) == SUCCESS) {
|
||||
RETURN_BOOL(((*ce)->ce_flags & ZEND_ACC_INTERFACE) > 0);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
+69
-59
@@ -761,6 +761,9 @@ void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC)
|
||||
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:
|
||||
@@ -992,35 +995,37 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
fn_flags |= ZEND_ACC_PUBLIC;
|
||||
}
|
||||
|
||||
short_class_name = do_alloca(short_class_name_length + 1);
|
||||
zend_str_tolower_copy(short_class_name, CG(active_class_entry)->name, short_class_name_length);
|
||||
/* Improve after RC: cache the lowercase class name */
|
||||
|
||||
if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
} else {
|
||||
if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
short_class_name = do_alloca(short_class_name_length + 1);
|
||||
zend_str_tolower_copy(short_class_name, CG(active_class_entry)->name, short_class_name_length);
|
||||
/* Improve after RC: cache the lowercase class name */
|
||||
|
||||
if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, name_len))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
} else {
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
}
|
||||
} else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
}
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
|
||||
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
|
||||
}
|
||||
} else if ((name_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)))) {
|
||||
if (CG(active_class_entry)->constructor) {
|
||||
zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name);
|
||||
}
|
||||
CG(active_class_entry)->constructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->destructor = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CLONE_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->clone = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__call = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__get = (zend_function *) CG(active_op_array);
|
||||
} else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)))) {
|
||||
CG(active_class_entry)->__set = (zend_function *) CG(active_op_array);
|
||||
} else if (!(fn_flags & ZEND_ACC_STATIC)) {
|
||||
CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC;
|
||||
free_alloca(short_class_name);
|
||||
}
|
||||
free_alloca(short_class_name);
|
||||
|
||||
efree(lcname);
|
||||
} else {
|
||||
@@ -1087,16 +1092,26 @@ void zend_do_handle_exception(TSRMLS_D)
|
||||
|
||||
void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
|
||||
{
|
||||
char lcname[16];
|
||||
int name_len;
|
||||
|
||||
zend_do_extended_info(TSRMLS_C);
|
||||
zend_do_return(NULL, 0 TSRMLS_CC);
|
||||
zend_do_handle_exception(TSRMLS_C);
|
||||
|
||||
pass_two(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (CG(active_class_entry)
|
||||
&& !strcmp(CG(active_op_array)->function_name, ZEND_CLONE_FUNC_NAME)
|
||||
&& CG(active_op_array)->num_args != 0) {
|
||||
zend_error(E_COMPILE_ERROR, "The clone method cannot accept any arguments");
|
||||
if (CG(active_class_entry)) {
|
||||
zend_check_magic_method_implementation(CG(active_class_entry), (zend_function*)CG(active_op_array), E_COMPILE_ERROR TSRMLS_CC);
|
||||
} else {
|
||||
/* we don't care if the function name is longer, in fact lowercasing only
|
||||
* the beginning of the name speeds up the check process */
|
||||
name_len = strlen(CG(active_op_array)->function_name);
|
||||
zend_str_tolower_copy(lcname, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname)-1));
|
||||
lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */
|
||||
if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) && CG(active_op_array)->num_args != 1) {
|
||||
zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
CG(active_op_array)->line_end = zend_get_compiled_lineno(TSRMLS_C);
|
||||
@@ -1114,10 +1129,6 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
zend_arg_info *cur_arg_info;
|
||||
|
||||
if (CG(active_class_entry) && CG(active_class_entry)->destructor == (zend_function *) CG(active_op_array))
|
||||
{
|
||||
zend_error(E_COMPILE_ERROR, "Destuctor %s::%s() cannot take arguments", CG(active_class_entry)->name, CG(active_op_array)->function_name);
|
||||
}
|
||||
CG(active_op_array)->num_args++;
|
||||
opline->opcode = op;
|
||||
opline->result = *var;
|
||||
@@ -1298,36 +1309,27 @@ void zend_do_fetch_class_name(znode *result, znode *class_name_entry, znode *cla
|
||||
result->u.constant.value.str.len = length;
|
||||
}
|
||||
|
||||
void zend_do_begin_class_member_function_call(TSRMLS_D)
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC)
|
||||
{
|
||||
unsigned char *ptr = NULL;
|
||||
long fetch_const_op_number = get_next_op_number(CG(active_op_array));
|
||||
zend_op *last_op = &CG(active_op_array)->opcodes[fetch_const_op_number-1];
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
if (last_op->opcode == ZEND_FETCH_CONSTANT) { /* regular method call */
|
||||
/* a tmp var is leaked here */
|
||||
last_op->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
if(last_op->op2.op_type == IS_CONST &&
|
||||
(sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(last_op->op2.u.constant) &&
|
||||
memcmp(Z_STRVAL(last_op->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
|
||||
zval_dtor(&last_op->op2.u.constant);
|
||||
SET_UNUSED(last_op->op2);
|
||||
opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
opline->op1 = *class_name;
|
||||
opline->op2 = *method_name;
|
||||
|
||||
if (opline->op2.op_type == IS_CONST) {
|
||||
if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(opline->op2.u.constant) &&
|
||||
memcmp(Z_STRVAL(opline->op2.u.constant), ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
|
||||
zval_dtor(&opline->op2.u.constant);
|
||||
SET_UNUSED(opline->op2);
|
||||
} else {
|
||||
zend_lowercase_znode_if_const(&last_op->op2);
|
||||
zend_str_tolower(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len);
|
||||
}
|
||||
} else if (last_op->opcode == ZEND_FETCH_R) { /* indirect method call */
|
||||
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
|
||||
|
||||
last_op->op2.u.EA.type = ZEND_FETCH_LOCAL;
|
||||
opline->opcode = ZEND_INIT_STATIC_METHOD_CALL;
|
||||
opline->op1 = last_op->op2;
|
||||
opline->op2 = last_op->result;
|
||||
} else {
|
||||
zend_error(E_COMPILE_ERROR, "Internal compiler error - please report!");
|
||||
}
|
||||
|
||||
|
||||
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
|
||||
zend_do_extended_fcall_begin(TSRMLS_C);
|
||||
}
|
||||
|
||||
|
||||
@@ -1675,9 +1677,11 @@ static void do_inherit_parent_constructor(zend_class_entry *ce)
|
||||
if (!zend_hash_exists(&ce->function_table, lc_class_name, ce->name_length+1)) {
|
||||
lc_parent_class_name = zend_str_tolower_dup(ce->parent->name, ce->parent->name_length);
|
||||
if (zend_hash_find(&ce->parent->function_table, lc_parent_class_name, ce->parent->name_length+1, (void **)&function)==SUCCESS) {
|
||||
/* inherit parent's constructor */
|
||||
zend_hash_update(&ce->function_table, lc_class_name, ce->name_length+1, function, sizeof(zend_function), NULL);
|
||||
function_add_ref(function);
|
||||
if (function->common.fn_flags & ZEND_ACC_CTOR) {
|
||||
/* inherit parent's constructor */
|
||||
zend_hash_update(&ce->function_table, lc_class_name, ce->name_length+1, function, sizeof(zend_function), NULL);
|
||||
function_add_ref(function);
|
||||
}
|
||||
}
|
||||
efree(lc_parent_class_name);
|
||||
}
|
||||
@@ -1993,6 +1997,8 @@ void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce TSRML
|
||||
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
|
||||
zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
|
||||
do_inherit_parent_constructor(ce);
|
||||
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
@@ -2100,6 +2106,10 @@ ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *c
|
||||
ce = *pce;
|
||||
}
|
||||
|
||||
if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) {
|
||||
zend_error(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name, parent_ce->name);
|
||||
}
|
||||
|
||||
zend_do_inheritance(ce, parent_ce TSRMLS_CC);
|
||||
|
||||
ce->refcount++;
|
||||
|
||||
+2
-1
@@ -375,7 +375,7 @@ void zend_do_clone(znode *result, znode *expr TSRMLS_DC);
|
||||
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
|
||||
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
|
||||
void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name TSRMLS_DC);
|
||||
void zend_do_begin_class_member_function_call(TSRMLS_D);
|
||||
void zend_do_begin_class_member_function_call(znode *class_name, znode *method_name TSRMLS_DC);
|
||||
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
|
||||
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
|
||||
void zend_do_handle_exception(TSRMLS_D);
|
||||
@@ -840,6 +840,7 @@ END_EXTERN_C()
|
||||
#define ZEND_GET_FUNC_NAME "__get"
|
||||
#define ZEND_SET_FUNC_NAME "__set"
|
||||
#define ZEND_CALL_FUNC_NAME "__call"
|
||||
#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
|
||||
|
||||
#endif /* ZEND_COMPILE_H */
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ typedef unsigned int uint;
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_STRCOLL 1
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
|
||||
+26
-16
@@ -52,6 +52,7 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_
|
||||
#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset))
|
||||
#define T(offset) (*(temp_variable *)((char *) Ts + offset))
|
||||
|
||||
#define TEMP_VAR_STACK_LIMIT 2000
|
||||
|
||||
/* former zend_execute_locks.h */
|
||||
static inline void zend_pzval_lock_func(zval *z)
|
||||
@@ -1330,7 +1331,11 @@ static int zend_check_symbol(zval **pz TSRMLS_DC)
|
||||
}
|
||||
|
||||
#define RETURN_FROM_EXECUTE_LOOP(execute_data) \
|
||||
efree(EX(Ts)); \
|
||||
if (EX(op_array)->T < TEMP_VAR_STACK_LIMIT) { \
|
||||
free_alloca(EX(Ts)); \
|
||||
} else { \
|
||||
efree(EX(Ts)); \
|
||||
} \
|
||||
EG(in_execution) = EX(original_in_execution); \
|
||||
EG(current_execute_data) = EX(prev_execute_data); \
|
||||
return 1; /* CHECK_ME */
|
||||
@@ -1349,7 +1354,11 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
|
||||
/* Initialize execute_data */
|
||||
EX(fbc) = NULL;
|
||||
EX(object) = NULL;
|
||||
EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
|
||||
if (op_array->T < TEMP_VAR_STACK_LIMIT) {
|
||||
EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
|
||||
} else {
|
||||
EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
|
||||
}
|
||||
EX(op_array) = op_array;
|
||||
EX(original_in_execution) = EG(in_execution);
|
||||
EX(prev_execute_data) = EG(current_execute_data);
|
||||
@@ -1766,6 +1775,9 @@ static inline int zend_binary_assign_op_helper(int (*binary_op)(zval *result, zv
|
||||
EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
|
||||
SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result);
|
||||
AI_USE_PTR(EX_T(opline->result.u.var).var);
|
||||
if (increment_opline) {
|
||||
INC_OPCODE();
|
||||
}
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
|
||||
@@ -2777,6 +2789,9 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (EG(This)) {
|
||||
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);
|
||||
}
|
||||
zval_ptr_dtor(&EG(This));
|
||||
} else if (should_change_scope) {
|
||||
zval_ptr_dtor(&EG(This));
|
||||
@@ -2929,21 +2944,16 @@ int zend_catch_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
}
|
||||
ce = Z_OBJCE_P(EG(exception));
|
||||
if (ce != EX_T(opline->op1.u.var).class_entry) {
|
||||
while (ce->parent) {
|
||||
if (ce->parent == EX_T(opline->op1.u.var).class_entry) {
|
||||
goto exception_should_be_taken;
|
||||
if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
|
||||
if (opline->op1.u.EA.type) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
ce = ce->parent;
|
||||
SET_OPCODE(&op_array->opcodes[opline->extended_value]);
|
||||
return 0; /* CHECK_ME */
|
||||
}
|
||||
if (opline->op1.u.EA.type) {
|
||||
zend_throw_exception_internal(NULL TSRMLS_CC);
|
||||
NEXT_OPCODE();
|
||||
}
|
||||
SET_OPCODE(&op_array->opcodes[opline->extended_value]);
|
||||
return 0; /* CHECK_ME */
|
||||
}
|
||||
|
||||
exception_should_be_taken:
|
||||
zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val,
|
||||
opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
|
||||
EG(exception) = NULL;
|
||||
@@ -3699,7 +3709,7 @@ int zend_fe_reset_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
if (opline->extended_value) {
|
||||
array_ptr_ptr = get_zval_ptr_ptr(&opline->op1, EX(Ts), BP_VAR_R);
|
||||
if (array_ptr_ptr == NULL) {
|
||||
MAKE_STD_ZVAL(array_ptr);
|
||||
ALLOC_INIT_ZVAL(array_ptr);
|
||||
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
|
||||
ce = Z_OBJCE_PP(array_ptr_ptr);
|
||||
if (!ce || ce->get_iterator == NULL) {
|
||||
@@ -4025,12 +4035,12 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
|
||||
} else if ((*container)->type == IS_STRING) { /* string offsets */
|
||||
switch (opline->extended_value) {
|
||||
case ZEND_ISSET:
|
||||
if (offset->value.lval <= Z_STRLEN_PP(container)) {
|
||||
if (offset->value.lval < Z_STRLEN_PP(container)) {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
case ZEND_ISEMPTY:
|
||||
if (offset->value.lval <= Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
if (offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') {
|
||||
result = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -208,6 +208,9 @@ 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 */
|
||||
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
|
||||
zend_try {
|
||||
@@ -911,7 +914,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(&autoload_function, "__autoload", sizeof("__autoload")-1, 0);
|
||||
ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 0);
|
||||
|
||||
INIT_PZVAL(class_name_ptr);
|
||||
ZVAL_STRINGL(class_name_ptr, name, name_length, 0);
|
||||
@@ -932,7 +935,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
|
||||
if (EG(exception)) {
|
||||
free_alloca(lc_name);
|
||||
zend_error(E_ERROR, "__autoload(%s) threw an exception of type '%s'", name, Z_OBJCE_P(EG(exception))->name);
|
||||
zend_error(E_ERROR, "Function %s(%s) threw an exception of type '%s'", ZEND_AUTOLOAD_FUNC_NAME, name, Z_OBJCE_P(EG(exception))->name);
|
||||
return FAILURE;
|
||||
}
|
||||
EG(exception) = exception;
|
||||
|
||||
+10
-4
@@ -159,6 +159,12 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
|
||||
switch (token_type) {
|
||||
case T_END_HEREDOC:
|
||||
zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
|
||||
{
|
||||
char *ptr = LANG_SCNG(yy_text);
|
||||
if (ptr[LANG_SCNG(yy_leng) - 1] != ';') {
|
||||
zend_html_putc('\n');
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
|
||||
@@ -203,7 +209,7 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
switch (token_type) {
|
||||
case T_WHITESPACE:
|
||||
if (!prev_space) {
|
||||
putchar(' ');
|
||||
zend_write(" ", sizeof(" ") - 1);
|
||||
prev_space = 1;
|
||||
}
|
||||
/* lack of break; is intentional */
|
||||
@@ -215,9 +221,9 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
case T_END_HEREDOC: {
|
||||
char *ptr = LANG_SCNG(yy_text);
|
||||
|
||||
fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout);
|
||||
zend_write(ptr, LANG_SCNG(yy_leng) - 1);
|
||||
/* The ensure that we only write one ; and that it followed by the required newline */
|
||||
putchar('\n');
|
||||
zend_write("\n", sizeof("\n") - 1);
|
||||
if (ptr[LANG_SCNG(yy_leng) - 1] == ';') {
|
||||
lex_scan(&token TSRMLS_CC);
|
||||
}
|
||||
@@ -226,7 +232,7 @@ ZEND_API void zend_strip(TSRMLS_D)
|
||||
break;
|
||||
|
||||
default:
|
||||
fwrite(LANG_SCNG(yy_text), LANG_SCNG(yy_leng), 1, stdout);
|
||||
zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -147,10 +147,25 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|
||||
zend_ini_entry *p = ini_entry;
|
||||
zend_ini_entry *hashed_ini_entry;
|
||||
zval default_value;
|
||||
HashTable *directives = registered_zend_ini_directives;
|
||||
|
||||
#ifdef ZTS
|
||||
/* if we are called during the request, eg: from dl(),
|
||||
* then we should not touch the global directives table,
|
||||
* and should update the per-(request|thread) version instead.
|
||||
* This solves two problems: one is that ini entries for dl()'d
|
||||
* extensions will now work, and the second is that updating the
|
||||
* global hash here from dl() is not mutex protected and can
|
||||
* lead to death.
|
||||
*/
|
||||
if (directives != EG(ini_directives)) {
|
||||
directives = EG(ini_directives);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (p->name) {
|
||||
p->module_number = module_number;
|
||||
if (zend_hash_add(registered_zend_ini_directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
|
||||
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
|
||||
zend_unregister_ini_entries(module_number TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ END_EXTERN_C()
|
||||
/* INI parsing engine */
|
||||
typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type, void *arg);
|
||||
BEGIN_EXTERN_C()
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
|
||||
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_INI_PARSER_ENTRY 1
|
||||
|
||||
@@ -139,7 +139,7 @@ static void ini_error(char *str)
|
||||
}
|
||||
|
||||
|
||||
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
|
||||
ZEND_API int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg)
|
||||
{
|
||||
int retval;
|
||||
zend_ini_parser_param ini_parser_param;
|
||||
|
||||
@@ -614,12 +614,12 @@ function_call:
|
||||
T_STRING '(' { $2.u.opline_num = zend_do_begin_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C); }
|
||||
| class_constant '(' { zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); }
|
||||
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| static_member '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(TSRMLS_C); zend_do_extended_fcall_begin(TSRMLS_C); }
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_class_member_function_call(&$1, &$3 TSRMLS_CC); }
|
||||
function_call_parameter_list
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$4, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
')' { zend_do_end_function_call(NULL, &$$, &$6, 1, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
| variable_without_objects '(' { zend_do_end_variable_parse(BP_VAR_R, 0 TSRMLS_CC); zend_do_begin_dynamic_function_call(&$1 TSRMLS_CC); }
|
||||
function_call_parameter_list ')'
|
||||
{ zend_do_end_function_call(&$1, &$$, &$4, 0, 1 TSRMLS_CC); zend_do_extended_fcall_end(TSRMLS_C);}
|
||||
|
||||
+6
-3
@@ -76,10 +76,13 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
|
||||
old_exception = EG(exception);
|
||||
EG(exception) = NULL;
|
||||
zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL);
|
||||
if (EG(exception)) {
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
if (old_exception) {
|
||||
if (EG(exception)) {
|
||||
zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active", object->ce->name);
|
||||
zval_ptr_dtor(&EG(exception));
|
||||
}
|
||||
EG(exception) = old_exception;
|
||||
}
|
||||
EG(exception) = old_exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,16 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
zend_uint i = 1;
|
||||
|
||||
for (i = 1; i < objects->top ; i++) {
|
||||
if (objects->object_buckets[i].valid) {
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
@@ -207,6 +217,15 @@ ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC
|
||||
}
|
||||
|
||||
|
||||
/* Called when the ctor was terminated by an exception */
|
||||
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC)
|
||||
{
|
||||
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
|
||||
|
||||
EG(objects_store).object_buckets[handle].destructor_called = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Proxy objects workings */
|
||||
typedef struct _zend_proxy_object {
|
||||
zval *object;
|
||||
|
||||
@@ -57,6 +57,7 @@ typedef struct _zend_objects_store {
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
|
||||
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
|
||||
|
||||
/* Store API functions */
|
||||
@@ -68,6 +69,7 @@ ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
|
||||
ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
|
||||
/* See comment in zend_objects_API.c before you use this */
|
||||
ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
|
||||
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);
|
||||
|
||||
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
|
||||
|
||||
|
||||
+38
-1
@@ -183,7 +183,15 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
|
||||
}
|
||||
|
||||
|
||||
#define DVAL_TO_LVAL(d, l) (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d)
|
||||
#define DVAL_TO_LVAL(d, l) do { \
|
||||
if ((d) > LONG_MAX) { \
|
||||
l = LONG_MAX; \
|
||||
} else if ((d) < LONG_MIN) { \
|
||||
l = LONG_MIN; \
|
||||
} else { \
|
||||
l = (d); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define zendi_convert_to_long(op, holder, result) \
|
||||
if (op==result) { \
|
||||
@@ -1221,6 +1229,35 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
#if HAVE_STRCOLL
|
||||
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
int use_copy1, use_copy2;
|
||||
|
||||
zend_make_printable_zval(op1, &op1_copy, &use_copy1);
|
||||
zend_make_printable_zval(op2, &op2_copy, &use_copy2);
|
||||
|
||||
if (use_copy1) {
|
||||
op1 = &op1_copy;
|
||||
}
|
||||
if (use_copy2) {
|
||||
op2 = &op2_copy;
|
||||
}
|
||||
|
||||
result->value.lval = strcoll(op1->value.str.val, op2->value.str.val);
|
||||
result->type = IS_LONG;
|
||||
|
||||
if (use_copy1) {
|
||||
zval_dtor(op1);
|
||||
}
|
||||
if (use_copy2) {
|
||||
zval_dtor(op2);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
{
|
||||
zval op1_copy, op2_copy;
|
||||
|
||||
@@ -87,6 +87,8 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
|
||||
*lval = local_lval;
|
||||
}
|
||||
return IS_LONG;
|
||||
} else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.') { /* ignore partial string matches */
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
end_ptr_long=NULL;
|
||||
@@ -177,6 +179,9 @@ ZEND_API int zval_is_true(zval *op);
|
||||
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
#if HAVE_STRCOLL
|
||||
ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
ZEND_API void zend_str_tolower(char *str, unsigned int length);
|
||||
ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length);
|
||||
|
||||
+32
-24
@@ -1356,7 +1356,7 @@ ZEND_METHOD(reflection_function, returnsReference)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionParameter[] Reflection_Function::getParameters()
|
||||
/* {{{ proto public ReflectionParameter[] ReflectionFunction::getParameters()
|
||||
Returns an array of parameter objects for this function */
|
||||
ZEND_METHOD(reflection_function, getParameters)
|
||||
{
|
||||
@@ -1541,7 +1541,7 @@ ZEND_METHOD(reflection_parameter, getName)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Parameter::getClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionParameter::getClass()
|
||||
Returns this parameters's class hint or NULL if there is none */
|
||||
ZEND_METHOD(reflection_parameter, getClass)
|
||||
{
|
||||
@@ -1879,7 +1879,7 @@ ZEND_METHOD(reflection_method, getModifiers)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Method::getDeclaringClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionMethod::getDeclaringClass()
|
||||
Get the declaring class */
|
||||
ZEND_METHOD(reflection_method, getDeclaringClass)
|
||||
{
|
||||
@@ -2134,7 +2134,7 @@ ZEND_METHOD(reflection_class, getDocComment)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod Reflection_Class::getConstructor()
|
||||
/* {{{ proto public ReflectionMethod ReflectionClass::getConstructor()
|
||||
Returns the class' constructor if there is one, NULL otherwise */
|
||||
ZEND_METHOD(reflection_class, getConstructor)
|
||||
{
|
||||
@@ -2152,14 +2152,14 @@ ZEND_METHOD(reflection_class, getConstructor)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod Reflection_Class::getMethod(string name)
|
||||
/* {{{ proto public ReflectionMethod ReflectionClass::getMethod(string name) throws ReflectionException
|
||||
Returns the class' method specified by it's name */
|
||||
ZEND_METHOD(reflection_class, getMethod)
|
||||
{
|
||||
reflection_object *intern;
|
||||
zend_class_entry *ce;
|
||||
zend_function *mptr;
|
||||
char *name;
|
||||
char *name, *lc_name;
|
||||
int name_len;
|
||||
|
||||
METHOD_NOTSTATIC;
|
||||
@@ -2168,11 +2168,15 @@ ZEND_METHOD(reflection_class, getMethod)
|
||||
}
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
zend_str_tolower(name, name_len);
|
||||
if (zend_hash_find(&ce->function_table, name, name_len + 1, (void**) &mptr) == SUCCESS) {
|
||||
lc_name = zend_str_tolower_dup(name, name_len);
|
||||
if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) {
|
||||
reflection_method_factory(ce, mptr, return_value TSRMLS_CC);
|
||||
efree(lc_name);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
efree(lc_name);
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Method %s does not exist", name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2195,7 +2199,7 @@ static int _addmethod(zend_function *mptr, int num_args, va_list args, zend_hash
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionMethod[] Reflection_Class::getMethods()
|
||||
/* {{{ proto public ReflectionMethod[] ReflectionClass::getMethods()
|
||||
Returns an array of this class' methods */
|
||||
ZEND_METHOD(reflection_class, getMethods)
|
||||
{
|
||||
@@ -2221,7 +2225,7 @@ ZEND_METHOD(reflection_class, getMethods)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionProperty Reflection_Class::getProperty(string name)
|
||||
/* {{{ proto public ReflectionProperty ReflectionClass::getProperty(string name) throws ReflectionException
|
||||
Returns the class' property specified by it's name */
|
||||
ZEND_METHOD(reflection_class, getProperty)
|
||||
{
|
||||
@@ -2240,7 +2244,9 @@ ZEND_METHOD(reflection_class, getProperty)
|
||||
if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS) {
|
||||
reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
|
||||
} else {
|
||||
RETURN_NULL();
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Property %s does not exist", name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2263,7 +2269,7 @@ static int _addproperty(zend_property_info *pptr, int num_args, va_list args, ze
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionProperty[] Reflection_Class::getProperties()
|
||||
/* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties()
|
||||
Returns an array of this class' properties */
|
||||
ZEND_METHOD(reflection_class, getProperties)
|
||||
{
|
||||
@@ -2300,6 +2306,7 @@ ZEND_METHOD(reflection_class, getConstants)
|
||||
METHOD_NOTSTATIC_NUMPARAMS(0);
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
array_init(return_value);
|
||||
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), &ce->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2320,6 +2327,7 @@ ZEND_METHOD(reflection_class, getConstant)
|
||||
}
|
||||
|
||||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
if (zend_hash_find(&ce->constants_table, name, name_len + 1, (void **) &value) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2383,7 +2391,7 @@ ZEND_METHOD(reflection_class, isFinal)
|
||||
Returns whether this class is abstract */
|
||||
ZEND_METHOD(reflection_class, isAbstract)
|
||||
{
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
|
||||
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2478,7 +2486,7 @@ ZEND_METHOD(reflection_class, newInstance)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass[] Reflection_Class::getInterfaces()
|
||||
/* {{{ proto public ReflectionClass[] ReflectionClass::getInterfaces()
|
||||
Returns an array of interfaces this class implements */
|
||||
ZEND_METHOD(reflection_class, getInterfaces)
|
||||
{
|
||||
@@ -2504,7 +2512,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Class::getParentClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionClass::getParentClass()
|
||||
Returns the class' parent class, or, if none exists, FALSE */
|
||||
ZEND_METHOD(reflection_class, getParentClass)
|
||||
{
|
||||
@@ -2541,7 +2549,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
case IS_STRING:
|
||||
if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Interface %s doesn't exist", Z_STRVAL_P(class_name));
|
||||
"Interface %s does not exist", Z_STRVAL_P(class_name));
|
||||
return;
|
||||
}
|
||||
class_ce = *pce;
|
||||
@@ -2559,7 +2567,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
|
||||
/* no break */
|
||||
default:
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Parameter one must either be a string or a Reflection_Class object");
|
||||
"Parameter one must either be a string or a ReflectionClass object");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2587,7 +2595,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
|
||||
case IS_STRING:
|
||||
if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Interface %s doesn't exist", Z_STRVAL_P(interface));
|
||||
"Interface %s does not exist", Z_STRVAL_P(interface));
|
||||
return;
|
||||
}
|
||||
interface_ce = *pce;
|
||||
@@ -2605,7 +2613,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
|
||||
/* no break */
|
||||
default:
|
||||
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
|
||||
"Parameter one must either be a string or a Reflection_Class object");
|
||||
"Parameter one must either be a string or a ReflectionClass object");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2632,7 +2640,7 @@ ZEND_METHOD(reflection_class, isIterateable)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionExtension|NULL Reflection_Class::getExtension()
|
||||
/* {{{ proto public ReflectionExtension|NULL ReflectionClass::getExtension()
|
||||
Returns NULL or the extension the class belongs to */
|
||||
ZEND_METHOD(reflection_class, getExtension)
|
||||
{
|
||||
@@ -2953,7 +2961,7 @@ ZEND_METHOD(reflection_property, setValue)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass Reflection_Property::getDeclaringClass()
|
||||
/* {{{ proto public ReflectionClass ReflectionProperty::getDeclaringClass()
|
||||
Get the declaring class */
|
||||
ZEND_METHOD(reflection_property, getDeclaringClass)
|
||||
{
|
||||
@@ -3056,7 +3064,7 @@ ZEND_METHOD(reflection_extension, getVersion)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionFunction[] Reflection_Extension::getFunctions()
|
||||
/* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions()
|
||||
Returns an array of this extension's fuctions */
|
||||
ZEND_METHOD(reflection_extension, getFunctions)
|
||||
{
|
||||
@@ -3173,7 +3181,7 @@ static int add_extension_class(zend_class_entry **pce, int num_args, va_list arg
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto public ReflectionClass[] ReflectionExtension::getClasses()
|
||||
Returns an array containing Reflection_Class objects for all classes of this extension */
|
||||
Returns an array containing ReflectionClass objects for all classes of this extension */
|
||||
ZEND_METHOD(reflection_extension, getClasses)
|
||||
{
|
||||
reflection_object *intern;
|
||||
|
||||
+2
-2
@@ -40,8 +40,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
MAJOR_VERSION=5
|
||||
MINOR_VERSION=0
|
||||
RELEASE_VERSION=1
|
||||
EXTRA_VERSION="-dev"
|
||||
RELEASE_VERSION=2
|
||||
EXTRA_VERSION=""
|
||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
|
||||
|
||||
dnl Define where extension directories are located in the configure context
|
||||
|
||||
@@ -102,6 +102,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
struct dotnet_runtime_stuff *stuff;
|
||||
IObjectHandle *handle;
|
||||
DISPPARAMS params;
|
||||
OLECHAR *olestring;
|
||||
VARIANT vargs[2];
|
||||
VARIANT retval;
|
||||
HRESULT hr;
|
||||
@@ -138,10 +139,14 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
VariantInit(&retval);
|
||||
|
||||
V_VT(&vargs[0]) = VT_BSTR;
|
||||
V_BSTR(&vargs[0]) = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page TSRMLS_CC);
|
||||
olestring = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page TSRMLS_CC);
|
||||
V_BSTR(&vargs[0]) = SysAllocStringByteLen((char*)olestring, datatype_name_len * sizeof(OLECHAR));
|
||||
efree(olestring);
|
||||
|
||||
V_VT(&vargs[1]) = VT_BSTR;
|
||||
V_BSTR(&vargs[1]) = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC);
|
||||
olestring = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC);
|
||||
V_BSTR(&vargs[1]) = SysAllocStringByteLen((char*)olestring, assembly_name_len * sizeof(OLECHAR));
|
||||
efree(olestring);
|
||||
|
||||
hr = IDispatch_Invoke(stuff->dotnet_domain, stuff->create_instance, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
DISPATCH_METHOD, ¶ms, &retval, NULL, NULL);
|
||||
|
||||
@@ -194,7 +194,7 @@ 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);
|
||||
|
||||
@@ -286,11 +286,19 @@ static void function_dtor(void *pDest)
|
||||
}
|
||||
}
|
||||
|
||||
static PHP_FUNCTION(com_method_handler)
|
||||
{
|
||||
Z_OBJ_HANDLER_P(getThis(), call_method)(
|
||||
((zend_internal_function*)EG(function_state_ptr)->function)->function_name,
|
||||
INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
}
|
||||
|
||||
static union _zend_function *com_method_get(zval *object, char *name, int len TSRMLS_DC)
|
||||
{
|
||||
zend_internal_function f, *fptr = NULL;
|
||||
php_com_dotnet_object *obj;
|
||||
union _zend_function *func;
|
||||
DISPID dummy;
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
@@ -298,6 +306,10 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check cache */
|
||||
if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, name, len, (void**)&fptr)) {
|
||||
f.type = ZEND_OVERLOADED_FUNCTION;
|
||||
@@ -306,7 +318,10 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
f.scope = obj->ce;
|
||||
f.fn_flags = 0;
|
||||
f.function_name = estrndup(name, len);
|
||||
f.handler = PHP_FN(com_method_handler);
|
||||
|
||||
fptr = &f;
|
||||
|
||||
if (obj->typeinfo) {
|
||||
/* look for byref params */
|
||||
ITypeComp *comp;
|
||||
@@ -346,6 +361,9 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
case DESCKIND_TYPECOMP:
|
||||
ITypeComp_Release(bindptr.lptcomp);
|
||||
break;
|
||||
|
||||
case DESCKIND_NONE:
|
||||
break;
|
||||
}
|
||||
if (TI) {
|
||||
ITypeInfo_Release(TI);
|
||||
@@ -356,21 +374,27 @@ static union _zend_function *com_method_get(zval *object, char *name, int len TS
|
||||
}
|
||||
}
|
||||
|
||||
/* save this method in the cache */
|
||||
if (!obj->method_cache) {
|
||||
ALLOC_HASHTABLE(obj->method_cache);
|
||||
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
|
||||
}
|
||||
if (fptr) {
|
||||
/* save this method in the cache */
|
||||
if (!obj->method_cache) {
|
||||
ALLOC_HASHTABLE(obj->method_cache);
|
||||
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
|
||||
}
|
||||
|
||||
zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
|
||||
zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* duplicate this into a new chunk of emalloc'd memory,
|
||||
* since the engine will efree it */
|
||||
func = emalloc(sizeof(*fptr));
|
||||
memcpy(func, fptr, sizeof(*fptr));
|
||||
if (fptr) {
|
||||
/* duplicate this into a new chunk of emalloc'd memory,
|
||||
* since the engine will efree it */
|
||||
func = emalloc(sizeof(*fptr));
|
||||
memcpy(func, fptr, sizeof(*fptr));
|
||||
|
||||
return func;
|
||||
return func;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
|
||||
|
||||
@@ -799,7 +799,8 @@ PHP_FUNCTION(variant_date_from_timestamp)
|
||||
}
|
||||
|
||||
VariantInit(&res);
|
||||
tmv = gmtime(×tamp);
|
||||
tzset();
|
||||
tmv = localtime(×tamp);
|
||||
memset(&systime, 0, sizeof(systime));
|
||||
|
||||
systime.wDay = tmv->tm_mday;
|
||||
|
||||
@@ -296,12 +296,16 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
|
||||
} else if (wFlags & DISPATCH_PROPERTYPUT) {
|
||||
zend_update_property(Z_OBJCE_P(disp->object), disp->object, Z_STRVAL_PP(name), Z_STRLEN_PP(name)+1, *params[0] TSRMLS_CC);
|
||||
} else if (wFlags & DISPATCH_METHOD) {
|
||||
if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
|
||||
&retval, pdp->cArgs, params, 1, NULL TSRMLS_CC)) {
|
||||
ret = S_OK;
|
||||
} else {
|
||||
zend_try {
|
||||
if (SUCCESS == call_user_function_ex(EG(function_table), &disp->object, *name,
|
||||
&retval, pdp->cArgs, params, 1, NULL TSRMLS_CC)) {
|
||||
ret = S_OK;
|
||||
} else {
|
||||
ret = DISP_E_EXCEPTION;
|
||||
}
|
||||
} zend_catch {
|
||||
ret = DISP_E_EXCEPTION;
|
||||
}
|
||||
} zend_end_try();
|
||||
} else {
|
||||
trace("Don't know how to handle this invocation %08x\n", wFlags);
|
||||
}
|
||||
|
||||
+7
-1
@@ -97,7 +97,13 @@ PHP_MINFO_FUNCTION(ctype)
|
||||
return; \
|
||||
switch (Z_TYPE_P(c)) { \
|
||||
case IS_LONG: \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
||||
} else if (Z_LVAL_P(c) >= -128) { \
|
||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
||||
} \
|
||||
SEPARATE_ZVAL(&c); \
|
||||
convert_to_string(c); \
|
||||
case IS_STRING: \
|
||||
{ \
|
||||
char *p; \
|
||||
|
||||
+11
-1
@@ -220,6 +220,9 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_UNRESTRICTED_AUTH);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_FTP_USE_EPRT);
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTP200ALIASES);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
|
||||
REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
|
||||
@@ -231,7 +234,11 @@ PHP_MINIT_FUNCTION(curl)
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANY);
|
||||
REGISTER_CURL_CONSTANT(CURLAUTH_ANYSAFE);
|
||||
#endif
|
||||
|
||||
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
REGISTER_CURL_CONSTANT(CURLOPT_PROXYAUTH);
|
||||
#endif
|
||||
|
||||
/* Constants effecting the way CURLOPT_CLOSEPOLICY works */
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
|
||||
REGISTER_CURL_CONSTANT(CURLCLOSEPOLICY_LEAST_TRAFFIC);
|
||||
@@ -912,6 +919,9 @@ PHP_FUNCTION(curl_setopt)
|
||||
case CURLOPT_FTP_USE_EPRT:
|
||||
#if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
|
||||
case CURLOPT_HTTPAUTH:
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM > 0x070a06 /* CURLOPT_PROXYAUTH is available since curl 7.10.7 */
|
||||
case CURLOPT_PROXYAUTH:
|
||||
#endif
|
||||
case CURLOPT_UNRESTRICTED_AUTH:
|
||||
case CURLOPT_PORT:
|
||||
|
||||
+1
-1
@@ -299,7 +299,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0);
|
||||
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, "PHP/" PHP_VERSION);
|
||||
curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP_VERSION);
|
||||
|
||||
/* TODO: read cookies and options from context */
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ magic_quotes_runtime=1
|
||||
require_once('test.inc');
|
||||
echo "database handler: $handler\n";
|
||||
// print md5 checksum of test.cdb which is generated by cdb_make program
|
||||
var_dump(md5(implode('',file(dirname(__FILE__).'/test.cdb'))));
|
||||
var_dump(md5_file(dirname(__FILE__).'/test.cdb'));
|
||||
if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
|
||||
dba_insert("1", "1", $db_make);
|
||||
dba_insert("2", "2", $db_make);
|
||||
@@ -26,7 +26,7 @@ magic_quotes_runtime=1
|
||||
// dba_replace cdb_make doesn't know replace
|
||||
dba_close($db_make);
|
||||
// write md5 checksum of generated database file
|
||||
var_dump(md5(implode('',file($db_file))));
|
||||
var_dump(md5_file($db_file));
|
||||
// no need to test created database: this is done by dba_cdb_read.phpt
|
||||
} else {
|
||||
echo "Error creating database\n";
|
||||
@@ -34,5 +34,5 @@ magic_quotes_runtime=1
|
||||
?>
|
||||
--EXPECT--
|
||||
database handler: cdb_make
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "723d19f39c1b15b3b455dd64323148d1"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
|
||||
@@ -215,6 +215,11 @@ PHP_FUNCTION(dio_read)
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
if (bytes <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
data = emalloc(bytes + 1);
|
||||
res = read(f->fd, data, bytes);
|
||||
if (res <= 0) {
|
||||
@@ -244,6 +249,11 @@ PHP_FUNCTION(dio_write)
|
||||
return;
|
||||
}
|
||||
|
||||
if (trunc_len < 0 || trunc_len > data_len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
|
||||
|
||||
res = write(f->fd, data, trunc_len ? trunc_len : data_len);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
this module is experimental,
|
||||
its functions may change their names
|
||||
or move to extension all together
|
||||
so do not rely to much on them
|
||||
you have been warned!
|
||||
+7
-7
@@ -1016,7 +1016,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name */
|
||||
|
||||
@@ -1063,7 +1063,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
/* }}} end dom_document_import_node */
|
||||
|
||||
|
||||
/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName);
|
||||
/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
|
||||
Since: DOM Level 2
|
||||
*/
|
||||
@@ -1073,13 +1073,13 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
xmlDocPtr docp;
|
||||
xmlNodePtr nodep = NULL;
|
||||
xmlNsPtr nsptr = NULL;
|
||||
int ret, uri_len = 0, name_len = 0;
|
||||
char *uri, *name;
|
||||
int ret, uri_len = 0, name_len = 0, value_len = 0;
|
||||
char *uri, *name, *value = NULL;
|
||||
char *localname = NULL, *prefix = NULL;
|
||||
int errorcode;
|
||||
dom_object *intern;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1089,7 +1089,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
|
||||
if (errorcode == 0) {
|
||||
if (xmlValidateName((xmlChar *) localname, 0) == 0) {
|
||||
nodep = xmlNewDocNode (docp, NULL, localname, NULL);
|
||||
nodep = xmlNewDocNode (docp, NULL, localname, value);
|
||||
if (nodep != NULL && uri != NULL) {
|
||||
nsptr = xmlSearchNsByHref (nodep->doc, nodep, uri);
|
||||
if (nsptr == NULL) {
|
||||
@@ -1216,7 +1216,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_document_get_elements_by_tag_name_ns */
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
entityht = (xmlHashTable *) doctypep->entities;
|
||||
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
notationht = (xmlHashTable *) doctypep->notations;
|
||||
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
+2
-2
@@ -455,7 +455,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
|
||||
php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC);
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC);
|
||||
}
|
||||
/* }}} end dom_element_get_elements_by_tag_name */
|
||||
|
||||
@@ -777,7 +777,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
|
||||
namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC);
|
||||
local = xmlCharStrndup(name, name_len);
|
||||
nsuri = xmlCharStrndup(uri, uri_len);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri);
|
||||
dom_namednode_iter(intern, 0, namednode, NULL, local, nsuri TSRMLS_CC);
|
||||
|
||||
}
|
||||
/* }}} end dom_element_get_elements_by_tag_name_ns */
|
||||
|
||||
+2
-2
@@ -351,7 +351,7 @@ int dom_node_child_nodes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
} else {
|
||||
php_dom_create_interator(*retval, DOM_NODELIST TSRMLS_CC);
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -529,7 +529,7 @@ int dom_node_attributes_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
if (nodep->type == XML_ELEMENT_NODE) {
|
||||
php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
|
||||
intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
|
||||
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL);
|
||||
dom_namednode_iter(obj, XML_ATTRIBUTE_NODE, intern, NULL, NULL, NULL TSRMLS_CC);
|
||||
} else {
|
||||
ZVAL_NULL(*retval);
|
||||
}
|
||||
|
||||
+29
-8
@@ -35,6 +35,7 @@
|
||||
#define PHP_XPTR 2
|
||||
|
||||
zend_object_handlers dom_object_handlers;
|
||||
zend_object_handlers dom_ze1_object_handlers;
|
||||
|
||||
static HashTable classes;
|
||||
|
||||
@@ -333,7 +334,7 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
|
||||
|
||||
if (obj->clone == NULL) {
|
||||
zend_error(E_CORE_ERROR, "Trying to clone uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
||||
php_error(E_ERROR, "Trying to clone an uncloneable object of class %s", Z_OBJCE_P(zobject)->name);
|
||||
}
|
||||
|
||||
obj->clone(obj->object, &new_object TSRMLS_CC);
|
||||
@@ -346,11 +347,26 @@ zend_object_value dom_objects_store_clone_obj(zval *zobject TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
zend_object_value dom_objects_ze1_clone_obj(zval *zobject TSRMLS_DC)
|
||||
{
|
||||
php_error(E_ERROR, "Cannot clone object of class %s due to 'zend.ze1_compatibility_mode'", Z_OBJCE_P(zobject)->name);
|
||||
/* Return zobject->value.obj just to satisfy compiler */
|
||||
return zobject->value.obj;
|
||||
}
|
||||
|
||||
static zend_function_entry dom_functions[] = {
|
||||
PHP_FE(dom_import_simplexml, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static zend_object_handlers* dom_get_obj_handlers(TSRMLS_D) {
|
||||
if (EG(ze1_compatibility_mode)) {
|
||||
return &dom_ze1_object_handlers;
|
||||
} else {
|
||||
return &dom_object_handlers;
|
||||
}
|
||||
}
|
||||
|
||||
zend_module_entry dom_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"dom",
|
||||
@@ -379,12 +395,17 @@ PHP_MINIT_FUNCTION(dom)
|
||||
dom_object_handlers.get_property_ptr_ptr = NULL;
|
||||
dom_object_handlers.clone_obj = dom_objects_store_clone_obj;
|
||||
|
||||
memcpy(&dom_ze1_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
dom_ze1_object_handlers.read_property = dom_read_property;
|
||||
dom_ze1_object_handlers.write_property = dom_write_property;
|
||||
dom_ze1_object_handlers.get_property_ptr_ptr = NULL;
|
||||
dom_ze1_object_handlers.clone_obj = dom_objects_ze1_clone_obj;
|
||||
|
||||
zend_hash_init(&classes, 0, NULL, NULL, 1);
|
||||
|
||||
INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions);
|
||||
dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
|
||||
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
|
||||
dom_domexception_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED;
|
||||
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC);
|
||||
|
||||
REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
|
||||
@@ -806,7 +827,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns)
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC)
|
||||
{
|
||||
dom_nnodemap_object *mapptr;
|
||||
zval *baseobj = NULL;
|
||||
@@ -817,7 +838,7 @@ void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xml
|
||||
baseobj->type = IS_OBJECT;
|
||||
baseobj->is_ref = 1;
|
||||
baseobj->value.obj.handle = basenode->handle;
|
||||
baseobj->value.obj.handlers = &dom_object_handlers;
|
||||
baseobj->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
zval_copy_ctor(baseobj);
|
||||
}
|
||||
mapptr->baseobjptr = baseobj;
|
||||
@@ -897,7 +918,7 @@ zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -914,7 +935,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t)dom_xpath_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -978,7 +999,7 @@ zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_D
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, dom_nnodemap_object_dtor, (zend_objects_free_object_storage_t)dom_nnodemap_objects_free_storage, dom_objects_clone TSRMLS_CC);
|
||||
intern->handle = retval.handle;
|
||||
retval.handlers = &dom_object_handlers;
|
||||
retval.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -1015,7 +1036,7 @@ zval *php_dom_create_object(xmlNodePtr obj, int *found, zval *wrapper_in, zval *
|
||||
return_value->type = IS_OBJECT;
|
||||
return_value->is_ref = 1;
|
||||
return_value->value.obj.handle = intern->handle;
|
||||
return_value->value.obj.handlers = &dom_object_handlers;
|
||||
return_value->value.obj.handlers = dom_get_obj_handlers(TSRMLS_C);
|
||||
zval_copy_ctor(return_value);
|
||||
*found = 1;
|
||||
return return_value;
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ int dom_has_feature(char *feature, char *version);
|
||||
int dom_node_is_read_only(xmlNodePtr node);
|
||||
int dom_node_children_valid(xmlNodePtr node);
|
||||
void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns);
|
||||
void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC);
|
||||
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
|
||||
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
|
||||
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
|
||||
|
||||
@@ -23,7 +23,7 @@ function adjustDoctype($xml) {
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html><head><title>Hello world</title></head><body><p>
|
||||
This is a not well-formed<br/>
|
||||
html files with undeclared entities
|
||||
html files with undeclared entities 
|
||||
</p></body></html>
|
||||
--- save as HTML
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
enchant
|
||||
Pierre-Alain Joye, Ilia Alshanetsky
|
||||
@@ -1,36 +0,0 @@
|
||||
dnl
|
||||
dnl $Id$
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(enchant,for ENCHANT support,
|
||||
[ --with-enchant[=DIR] Include enchant support.
|
||||
GNU Aspell version 1.1.3 or higher required.])
|
||||
|
||||
if test "$PHP_ENCHANT" != "no"; then
|
||||
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
|
||||
if test "$PHP_ENCHANT" != "yes"; then
|
||||
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
|
||||
else
|
||||
ENCHANT_SEARCH_DIRS="/usr/local /usr"
|
||||
fi
|
||||
for i in $ENCHANT_SEARCH_DIRS; do
|
||||
if test -f $i/include/enchant/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include/enchant
|
||||
elif test -f $i/include/enchant.h; then
|
||||
ENCHANT_DIR=$i
|
||||
ENCHANT_INCDIR=$i/include
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$ENCHANT_DIR"; then
|
||||
AC_MSG_ERROR(Cannot find enchant)
|
||||
fi
|
||||
|
||||
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
|
||||
|
||||
AC_DEFINE(HAVE_ENCHANT,1,[ ])
|
||||
PHP_SUBST(ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
|
||||
fi
|
||||
@@ -1,9 +0,0 @@
|
||||
// $Id$
|
||||
// vim:ft=javascript
|
||||
|
||||
ARG_ENABLE("enchant", "Enchant Support", "no");
|
||||
|
||||
if (PHP_ENCHANT == "yes") {
|
||||
EXTENSION("enchant", "enchant.c");
|
||||
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
$tag = 'en_US';
|
||||
$r = enchant_broker_init();
|
||||
$bprovides = enchant_broker_describe($r);
|
||||
echo "Current broker provides the following backend(s):\n";
|
||||
print_r($bprovides);
|
||||
|
||||
|
||||
if (enchant_broker_dict_exists($r,$tag)) {
|
||||
$d = enchant_broker_request_dict($r, $tag);
|
||||
$dprovides = enchant_dict_describe($d);
|
||||
echo "dictionary $tag provides:\n";
|
||||
$spellerrors = enchant_dict_check($d, "soong");
|
||||
print_r($dprovides);
|
||||
echo "found $spellerrors spell errors\n";
|
||||
if ($spellerrors) {
|
||||
$suggs = enchant_dict_suggest($d, "soong");
|
||||
echo "Suggestions for 'soong':";
|
||||
print_r($suggs);
|
||||
}
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
?>
|
||||
@@ -1,731 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
| Ilia Alshanetsky <ilia@prohost.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "enchant.h"
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_enchant.h"
|
||||
|
||||
|
||||
typedef EnchantBroker * EnchantBrokerPtr;
|
||||
typedef struct _broker_struct enchant_broker;
|
||||
typedef struct _dict_struct enchant_dict;
|
||||
|
||||
typedef enchant_broker * enchant_brokerPtr;
|
||||
typedef enchant_dict * enchant_dictPtr;
|
||||
|
||||
typedef struct _broker_struct {
|
||||
EnchantBroker *pbroker;
|
||||
enchant_dict **dict;
|
||||
unsigned int dictcnt;
|
||||
zval *rsrc_id;
|
||||
} _enchant_broker;
|
||||
|
||||
typedef struct _dict_struct {
|
||||
unsigned int id;
|
||||
EnchantDict *pdict;
|
||||
enchant_broker *pbroker;
|
||||
zval *rsrc_id;
|
||||
enchant_dict *next;
|
||||
enchant_dict *prev;
|
||||
} _enchant_dict;
|
||||
|
||||
|
||||
/* True global resources - no need for thread safety here */
|
||||
static int le_enchant_broker;
|
||||
static int le_enchant_dict;
|
||||
|
||||
/* If you declare any globals in php_enchant.h uncomment this:*/
|
||||
/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
|
||||
|
||||
/* {{{ enchant_functions[]
|
||||
*
|
||||
* Every user visible function must have an entry in enchant_functions[].
|
||||
*/
|
||||
function_entry enchant_functions[] = {
|
||||
PHP_FE(enchant_broker_init, NULL)
|
||||
PHP_FE(enchant_broker_free, NULL)
|
||||
PHP_FE(enchant_broker_get_error, NULL)
|
||||
PHP_FE(enchant_broker_request_dict, NULL)
|
||||
PHP_FE(enchant_broker_request_pwl_dict, NULL)
|
||||
PHP_FE(enchant_broker_free_dict, NULL)
|
||||
PHP_FE(enchant_broker_dict_exists, NULL)
|
||||
PHP_FE(enchant_broker_set_ordering, NULL)
|
||||
PHP_FE(enchant_broker_describe, NULL)
|
||||
PHP_FE(enchant_dict_check, NULL)
|
||||
PHP_FE(enchant_dict_suggest, NULL)
|
||||
PHP_FE(enchant_dict_add_to_personal, NULL)
|
||||
PHP_FE(enchant_dict_add_to_session, NULL)
|
||||
PHP_FE(enchant_dict_is_in_session, NULL)
|
||||
PHP_FE(enchant_dict_store_replacement, NULL)
|
||||
PHP_FE(enchant_dict_get_error, NULL)
|
||||
PHP_FE(enchant_dict_describe, NULL)
|
||||
PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
|
||||
|
||||
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ enchant_module_entry
|
||||
*/
|
||||
zend_module_entry enchant_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"enchant",
|
||||
enchant_functions,
|
||||
PHP_MINIT(enchant),
|
||||
PHP_MSHUTDOWN(enchant),
|
||||
NULL, /* Replace with NULL if there's nothing to do at request start */
|
||||
NULL, /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(enchant),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#ifdef COMPILE_DL_ENCHANT
|
||||
ZEND_GET_MODULE(enchant)
|
||||
#endif
|
||||
|
||||
static void
|
||||
enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
zval *tmp_array;
|
||||
|
||||
MAKE_STD_ZVAL(tmp_array);
|
||||
array_init(tmp_array);
|
||||
|
||||
add_assoc_string(tmp_array, "name", (char *)name, 1);
|
||||
add_assoc_string(tmp_array, "desc", (char *)desc, 1);
|
||||
add_assoc_string(tmp_array, "file", (char *)file, 1);
|
||||
|
||||
if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
|
||||
array_init(zdesc);
|
||||
}
|
||||
|
||||
add_next_index_zval(zdesc, tmp_array);
|
||||
}
|
||||
|
||||
static void
|
||||
describe_dict_fn (const char * const lang,
|
||||
const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
zval *zdesc = (zval *) ud;
|
||||
array_init(zdesc);
|
||||
add_assoc_string(zdesc, "lang", (char *)lang, 1);
|
||||
add_assoc_string(zdesc, "name", (char *)name, 1);
|
||||
add_assoc_string(zdesc, "desc", (char *)desc, 1);
|
||||
add_assoc_string(zdesc, "file", (char *)file, 1);
|
||||
}
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
enchant_broker *broker = (enchant_broker *)rsrc->ptr;
|
||||
if (broker) {
|
||||
if (broker->pbroker) {
|
||||
if (broker->dictcnt && broker->dict) {
|
||||
if (broker->dict) {
|
||||
int total, tofree;
|
||||
tofree = total = broker->dictcnt-1;
|
||||
do {
|
||||
zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
|
||||
efree(broker->dict[total]);
|
||||
total--;
|
||||
} while (total>=0);
|
||||
}
|
||||
efree(broker->dict);
|
||||
broker->dict = NULL;
|
||||
}
|
||||
enchant_broker_free(broker->pbroker);
|
||||
}
|
||||
efree(broker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
|
||||
if (pdict) {
|
||||
if (pdict->pdict && pdict->pbroker) {
|
||||
enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
|
||||
}
|
||||
if (pdict->id) {
|
||||
pdict->pbroker->dict[pdict->id-1]->next = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(enchant)
|
||||
{
|
||||
le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
|
||||
le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MSHUTDOWN_FUNCTION
|
||||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
static void __enumerate_providers_fn (const char * const name,
|
||||
const char * const desc,
|
||||
const char * const file,
|
||||
void * ud)
|
||||
{
|
||||
php_info_print_table_row(3, name, desc, file);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(enchant)
|
||||
{
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "enchant support", "enabled");
|
||||
php_info_print_table_row(2, "Version", "@version@");
|
||||
php_info_print_table_row(2, "Revision", "$Revision$");
|
||||
php_info_print_table_end();
|
||||
|
||||
php_info_print_table_start();
|
||||
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
|
||||
php_info_print_table_end();
|
||||
enchant_broker_free(pbroker);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#define PHP_ENCHANT_GET_BROKER \
|
||||
ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
|
||||
if (!pbroker || !pbroker->pbroker) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
#define PHP_ENCHANT_GET_DICT \
|
||||
ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict); \
|
||||
if (!pdict || !pdict->pdict) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* {{{ proto resource enchant_broker_init()
|
||||
create a new broker object capable of requesting */
|
||||
PHP_FUNCTION(enchant_broker_init)
|
||||
{
|
||||
enchant_broker *broker;
|
||||
EnchantBroker *pbroker;
|
||||
|
||||
if (ZEND_NUM_ARGS()) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
pbroker = enchant_broker_init();
|
||||
|
||||
if (pbroker) {
|
||||
broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
|
||||
broker->pbroker = pbroker;
|
||||
broker->dict = NULL;
|
||||
broker->dictcnt = 0;
|
||||
ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
|
||||
broker->rsrc_id = return_value;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto boolean enchant_free(resource broker)
|
||||
Destroys the broker object and its dictionnaries */
|
||||
PHP_FUNCTION(enchant_broker_free)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(broker));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string enchant_broker_get_error(resource broker)
|
||||
Returns the last error of the broker */
|
||||
PHP_FUNCTION(enchant_broker_get_error)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
char *msg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
msg = enchant_broker_get_error(pbroker->pbroker);
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
|
||||
create a new dictionary using tag, the non-empty language tag you wish to request
|
||||
a dictionary for ("en_US", "de_DE", ...) */
|
||||
PHP_FUNCTION(enchant_broker_request_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *tag;
|
||||
int taglen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
pos = pbroker->dictcnt++;
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos ? pbroker->dict[pos-1] : NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string filename)
|
||||
creates a dictionary using a PWL file. A PWL file is personal word file one word per line.
|
||||
It must exist before the call.*/
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict)
|
||||
{
|
||||
zval *broker;
|
||||
enchant_broker *pbroker;
|
||||
enchant_dict *dict;
|
||||
EnchantDict *d;
|
||||
char *pwl;
|
||||
int pwllen;
|
||||
int pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
|
||||
if (d) {
|
||||
if (pbroker->dictcnt) {
|
||||
pos = pbroker->dictcnt++;
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
dict->pdict = d;
|
||||
dict->rsrc_id = return_value;
|
||||
dict->prev = pos?pbroker->dict[pos-1]:NULL;
|
||||
dict->next = NULL;
|
||||
pbroker->dict[pos] = dict;
|
||||
if (pos) {
|
||||
pbroker->dict[pos-1]->next = dict;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource enchant_broker_free_dict(resource dict)
|
||||
Free the dictionary resource */
|
||||
PHP_FUNCTION(enchant_broker_free_dict)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(dict));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
|
||||
Wether a dictionary exists or not. Using non-empty tag */
|
||||
PHP_FUNCTION(enchant_broker_dict_exists)
|
||||
{
|
||||
zval *broker;
|
||||
char *tag;
|
||||
int taglen;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
|
||||
Declares a preference of dictionaries to use for the language
|
||||
described/referred to by 'tag'. The ordering is a comma delimited
|
||||
list of provider names. As a special exception, the "*" tag can
|
||||
be used as a language tag to declare a default ordering for any
|
||||
language that does not explictly declare an ordering. */
|
||||
|
||||
PHP_FUNCTION(enchant_broker_set_ordering)
|
||||
{
|
||||
zval *broker;
|
||||
char *pordering;
|
||||
int porderinglen;
|
||||
char *ptag;
|
||||
int ptaglen;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_broker_describe(resource broker)
|
||||
Enumerates the Enchant providers and tells
|
||||
you some rudimentary information about them. The same info is provided through phpinfo() */
|
||||
PHP_FUNCTION(enchant_broker_describe)
|
||||
{
|
||||
EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
|
||||
zval *broker;
|
||||
enchant_broker * pbroker;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_BROKER;
|
||||
|
||||
enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
|
||||
If the word is correctly spelled return true, otherwise return false, if suggestions variable
|
||||
is provided, fill it with spelling alternatives. */
|
||||
PHP_FUNCTION(enchant_dict_quick_check)
|
||||
{
|
||||
zval *dict, *sugg = NULL;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (sugg) {
|
||||
zval_dtor(sugg);
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
|
||||
if (!sugg && ZEND_NUM_ARGS() == 2) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
int n_sugg;
|
||||
char **suggs;
|
||||
|
||||
array_init(sugg);
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
if (suggs && n_sugg) {
|
||||
int i;
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
add_next_index_string(sugg, suggs[i], 1);
|
||||
}
|
||||
enchant_dict_free_suggestions(pdict->pdict, suggs);
|
||||
}
|
||||
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_check(resource dict, string word)
|
||||
If the word is correctly spelled return true, otherwise return false */
|
||||
PHP_FUNCTION(enchant_dict_check)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_dict_suggest(resource dict, string word)
|
||||
Will return a list of values if any of those pre-conditions are not met.*/
|
||||
PHP_FUNCTION(enchant_dict_suggest)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
char **suggs;
|
||||
enchant_dict *pdict;
|
||||
int n_sugg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
|
||||
if (suggs && n_sugg) {
|
||||
int i;
|
||||
|
||||
array_init(return_value);
|
||||
for (i = 0; i < n_sugg; i++) {
|
||||
add_next_index_string(return_value, suggs[i], 1);
|
||||
}
|
||||
|
||||
enchant_dict_free_suggestions(pdict->pdict, suggs);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word)
|
||||
add 'word' to personal word list */
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_add_to_session(resource dict, string word)
|
||||
add 'word' to this spell-checking session */
|
||||
PHP_FUNCTION(enchant_dict_add_to_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_add_to_session(pdict->pdict, word, wordlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word)
|
||||
whether or not 'word' exists in this spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_is_in_session)
|
||||
{
|
||||
zval *dict;
|
||||
char *word;
|
||||
int wordlen;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor)
|
||||
add a correction for 'mis' using 'cor'.
|
||||
Notes that you replaced @mis with @cor, so it's possibly more likely
|
||||
that future occurrences of @mis will be replaced with @cor. So it might
|
||||
bump @cor up in the suggestion list.*/
|
||||
PHP_FUNCTION(enchant_dict_store_replacement)
|
||||
{
|
||||
zval *dict;
|
||||
char *mis, *cor;
|
||||
int mislen, corlen;
|
||||
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string enchant_dict_get_error(resource dict)
|
||||
Returns the last error of the current spelling-session */
|
||||
PHP_FUNCTION(enchant_dict_get_error)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
char *msg;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
msg = enchant_dict_get_error(pdict->pdict);
|
||||
if (msg) {
|
||||
RETURN_STRING((char *)msg, 1);
|
||||
}
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array enchant_dict_describe(resource dict)
|
||||
Describes an individual dictionary 'dict' */
|
||||
PHP_FUNCTION(enchant_dict_describe)
|
||||
{
|
||||
zval *dict;
|
||||
enchant_dict *pdict;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_ENCHANT_GET_DICT;
|
||||
|
||||
enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>enchant</name>
|
||||
<summary>libenchant binder, support near all spelling tools</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>pajoye</user>
|
||||
<name>Pierre-Alain Joye</name>
|
||||
<email>paj@pearfr.org</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<user>iliaa</user>
|
||||
<name>Ilia Alshanetsky</name>
|
||||
<email>ilia@php.net</email>
|
||||
<role>developer</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>Enchant is a binder for libenchant. Libenchant provides a common
|
||||
API for many spell libraries:
|
||||
- aspell/pspell (intended to replace ispell)
|
||||
- hspell (hebrew)
|
||||
- ispell
|
||||
- myspell (OpenOffice project, mozilla)
|
||||
- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
|
||||
A plugin system allows to add custom spell support.
|
||||
see www.abisource.com/enchant/</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>0.2.1</version>
|
||||
<date>2004-03-11</date>
|
||||
<notes>- Fix possible leak in suggestions result
|
||||
- Move to beta status</notes>
|
||||
<filelist>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="config.w32"/>
|
||||
<file role="src" name="enchant.c"/>
|
||||
<file role="src" name="php_enchant.h"/>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<dir name="docs" role="doc">
|
||||
<dir name="examples">
|
||||
<file name="example1.php"/>
|
||||
</dir>
|
||||
</dir>
|
||||
</filelist>
|
||||
<configureoptions>
|
||||
<configureoption name="with-enchant" default="shared" prompt="libenchant prefix?"/>
|
||||
</configureoptions>
|
||||
<deps>
|
||||
<dep type="php" rel="ge" version="5" />
|
||||
</deps>
|
||||
</release>
|
||||
<changelog>
|
||||
<release>
|
||||
<state>alpha</state>
|
||||
<version>0.2.0</version>
|
||||
<notes>- Add Ilia Alshanetsky as maintainer
|
||||
- Cleanup sources codes (ilia)
|
||||
- Add enchant_dict_quick_check (ilia)</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version>0.1</version>
|
||||
<state>alpha</state>
|
||||
<date>2003-03-08</date>
|
||||
<notes>Initial release</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 4 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2003 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Pierre-Alain Joye <paj@pearfr.org> |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef PHP_ENCHANT_H
|
||||
#define PHP_ENCHANT_H
|
||||
|
||||
extern zend_module_entry enchant_module_entry;
|
||||
#define phpext_enchant_ptr &enchant_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_ENCHANT_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_ENCHANT_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
PHP_MINIT_FUNCTION(enchant);
|
||||
PHP_MSHUTDOWN_FUNCTION(enchant);
|
||||
PHP_MINFO_FUNCTION(enchant);
|
||||
|
||||
PHP_FUNCTION(enchant_broker_init);
|
||||
PHP_FUNCTION(enchant_broker_free);
|
||||
PHP_FUNCTION(enchant_broker_get_error);
|
||||
PHP_FUNCTION(enchant_broker_request_dict);
|
||||
PHP_FUNCTION(enchant_broker_request_pwl_dict);
|
||||
PHP_FUNCTION(enchant_broker_free_dict);
|
||||
PHP_FUNCTION(enchant_broker_dict_exists);
|
||||
PHP_FUNCTION(enchant_broker_set_ordering);
|
||||
PHP_FUNCTION(enchant_broker_describe);
|
||||
|
||||
PHP_FUNCTION(enchant_dict_check);
|
||||
PHP_FUNCTION(enchant_dict_suggest);
|
||||
PHP_FUNCTION(enchant_dict_add_to_personal);
|
||||
PHP_FUNCTION(enchant_dict_add_to_session);
|
||||
PHP_FUNCTION(enchant_dict_is_in_session);
|
||||
PHP_FUNCTION(enchant_dict_store_replacement);
|
||||
PHP_FUNCTION(enchant_dict_get_error);
|
||||
PHP_FUNCTION(enchant_dict_describe);
|
||||
PHP_FUNCTION(enchant_dict_quick_check);
|
||||
|
||||
#ifdef ZTS
|
||||
#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
|
||||
#else
|
||||
#define ENCHANT_G(v) (enchant_globals.v)
|
||||
#endif
|
||||
|
||||
#endif /* PHP_ENCHANT_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: t
|
||||
* End:
|
||||
*/
|
||||
|
||||
@@ -270,7 +270,7 @@ sopno stopst;
|
||||
/* figure out what it matched */
|
||||
switch (OP(m->g->strip[ss])) {
|
||||
case OEND:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
case OCHAR:
|
||||
sp++;
|
||||
@@ -286,7 +286,7 @@ sopno stopst;
|
||||
break;
|
||||
case OBACK_:
|
||||
case O_BACK:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
/* cases where length of match is hard to find */
|
||||
case OQUEST_:
|
||||
@@ -389,7 +389,7 @@ sopno stopst;
|
||||
case OOR1:
|
||||
case OOR2:
|
||||
case O_CH:
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
case OLPAREN:
|
||||
i = OPND(m->g->strip[ss]);
|
||||
@@ -402,7 +402,7 @@ sopno stopst;
|
||||
m->pmatch[i].rm_eo = sp - m->offp;
|
||||
break;
|
||||
default: /* uh oh */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -606,12 +606,12 @@ sopno lev; /* PLUS nesting level */
|
||||
return(NULL);
|
||||
break;
|
||||
default: /* uh oh */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/* "can't happen" */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
/* NOTREACHED */
|
||||
return((unsigned char *)NULL); /* dummy */
|
||||
}
|
||||
@@ -914,7 +914,7 @@ register states aft; /* states already known reachable after */
|
||||
FWD(aft, aft, 1);
|
||||
break;
|
||||
default: /* ooooops... */
|
||||
assert(nope);
|
||||
assert(PHP_REGEX_NOPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "utils.h"
|
||||
#include "regex2.h"
|
||||
|
||||
static int nope = 0; /* for use in asserts; shuts lint up */
|
||||
#define PHP_REGEX_NOPE 0; /* for use in asserts; shuts lint up */
|
||||
|
||||
/* macros for manipulating states, small version */
|
||||
#define states unsigned
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
fileinfo
|
||||
Ilia Alshanetsky
|
||||
Whitespace-only changes.
@@ -1,54 +0,0 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension fileinfo
|
||||
|
||||
PHP_ARG_WITH(fileinfo, for fileinfo support,
|
||||
[ --with-fileinfo=DIR Include fileinfo support])
|
||||
|
||||
if test "$PHP_FILEINFO" != "no"; then
|
||||
SEARCH_PATH="/usr/local /usr"
|
||||
SEARCH_FOR="/include/magic.h"
|
||||
if test -r $PHP_FILEINFO/$SEARCH_FOR; then
|
||||
FILEINFO_DIR=$PHP_FILEINFO
|
||||
else
|
||||
AC_MSG_CHECKING([for magic files in default path])
|
||||
for i in $SEARCH_PATH ; do
|
||||
if test -r $i/$SEARCH_FOR; then
|
||||
FILEINFO_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$FILEINFO_DIR"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([Please reinstall the libmagic distribution])
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($FILEINFO_DIR/include)
|
||||
|
||||
LIBNAME=magic
|
||||
LIBSYMBOL=magic_open
|
||||
|
||||
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
|
||||
[
|
||||
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FILEINFO_DIR/lib, FILEINFO_SHARED_LIBADD)
|
||||
AC_DEFINE(HAVE_FILEINFOLIB,1,[ ])
|
||||
],[
|
||||
AC_MSG_ERROR([wrong magic lib version or lib not found])
|
||||
],[
|
||||
-L$FILEINFO_DIR/lib -lm -ldl
|
||||
])
|
||||
|
||||
MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /etc/magic"
|
||||
for i in $MAGIC_MIME_LOCATIONS; do
|
||||
if test -f $i; then
|
||||
PHP_DEFAULT_MAGIC_FILE=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
|
||||
|
||||
PHP_SUBST(FILEINFO_SHARED_LIBADD)
|
||||
|
||||
PHP_NEW_EXTENSION(fileinfo, fileinfo.c, $ext_shared)
|
||||
fi
|
||||
@@ -1,433 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Ilia Alshanetsky <ilia@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <magic.h>
|
||||
/*
|
||||
* HOWMANY specifies the maximum offset libmagic will look at
|
||||
* this is currently hardcoded in the libmagic source but not exported
|
||||
*/
|
||||
#ifndef HOWMANY
|
||||
#define HOWMANY 65536
|
||||
#endif
|
||||
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/file.h" /* needed for context stuff */
|
||||
#include "php_fileinfo.h"
|
||||
#include "fopen_wrappers.h" /* needed for is_url */
|
||||
|
||||
struct php_fileinfo {
|
||||
long options;
|
||||
struct magic_set *magic;
|
||||
};
|
||||
|
||||
#ifndef PHP_DEFAULT_MAGIC_FILE
|
||||
#define PHP_DEFAULT_MAGIC_FILE NULL
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_ENGINE_2
|
||||
|
||||
static zend_object_handlers finfo_object_handlers;
|
||||
zend_class_entry *finfo_class_entry;
|
||||
|
||||
struct finfo_object {
|
||||
zend_object zo;
|
||||
struct php_fileinfo *ptr;
|
||||
};
|
||||
|
||||
#define FILEINFO_DECLARE_INIT_OBJECT(object) \
|
||||
zval *object = getThis();
|
||||
|
||||
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) \
|
||||
{ \
|
||||
struct finfo_object *obj; \
|
||||
obj = (struct finfo_object*)zend_object_store_get_object(_object TSRMLS_CC); \
|
||||
obj->ptr = _ptr; \
|
||||
}
|
||||
|
||||
#define FILEINFO_FROM_OBJECT(finfo, object) \
|
||||
{ \
|
||||
struct finfo_object *obj = zend_object_store_get_object(object TSRMLS_CC); \
|
||||
finfo = obj->ptr; \
|
||||
if (!finfo) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The invalid fileinfo object."); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* {{{ finfo_objects_dtor
|
||||
*/
|
||||
static void finfo_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
|
||||
{
|
||||
struct finfo_object *intern = (struct finfo_object *) object;
|
||||
|
||||
if (intern->ptr) {
|
||||
magic_close(intern->ptr->magic);
|
||||
efree(intern->ptr);
|
||||
}
|
||||
|
||||
efree(intern);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ finfo_objects_new
|
||||
*/
|
||||
PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_type TSRMLS_DC)
|
||||
{
|
||||
zend_object_value retval;
|
||||
struct finfo_object *intern;
|
||||
|
||||
intern = emalloc(sizeof(struct finfo_object));
|
||||
intern->zo.ce = class_type;
|
||||
intern->zo.in_get = 0;
|
||||
intern->zo.in_set = 0;
|
||||
intern->zo.properties = NULL;
|
||||
intern->ptr = NULL;
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);
|
||||
retval.handlers = (zend_object_handlers *) &finfo_object_handlers;
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ finfo_class_functions
|
||||
*/
|
||||
function_entry finfo_class_functions[] = {
|
||||
ZEND_ME_MAPPING(finfo, finfo_open, NULL)
|
||||
ZEND_ME_MAPPING(set_flags, finfo_set_flags,NULL)
|
||||
ZEND_ME_MAPPING(file, finfo_file, NULL)
|
||||
ZEND_ME_MAPPING(buffer, finfo_buffer, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#else
|
||||
|
||||
#define FILEINFO_REGISTER_OBJECT(_object, _ptr) {}
|
||||
#define FILEINFO_FROM_OBJECT(socket_id, object) {}
|
||||
|
||||
#define FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
#define object 0
|
||||
|
||||
#endif
|
||||
|
||||
#define FINFO_SET_OPTION(magic, options) \
|
||||
if (magic_setflags(magic, options) == -1) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
|
||||
options, magic_errno(magic), magic_error(magic)); \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* True global resources - no need for thread safety here */
|
||||
static int le_fileinfo;
|
||||
|
||||
void finfo_resource_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
if (rsrc->ptr) {
|
||||
struct php_fileinfo *finfo = (struct php_fileinfo *) rsrc->ptr;
|
||||
magic_close(finfo->magic);
|
||||
efree(rsrc->ptr);
|
||||
rsrc->ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ fileinfo_functions[]
|
||||
*/
|
||||
function_entry fileinfo_functions[] = {
|
||||
PHP_FE(finfo_open, NULL)
|
||||
PHP_FE(finfo_close, NULL)
|
||||
PHP_FE(finfo_set_flags, NULL)
|
||||
PHP_FE(finfo_file, NULL)
|
||||
PHP_FE(finfo_buffer, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ PHP_MINIT_FUNCTION
|
||||
*/
|
||||
PHP_MINIT_FUNCTION(finfo)
|
||||
{
|
||||
#ifdef ZEND_ENGINE_2
|
||||
zend_class_entry _finfo_class_entry;
|
||||
INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
|
||||
_finfo_class_entry.create_object = finfo_objects_new;
|
||||
finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC);
|
||||
|
||||
/* copy the standard object handlers to you handler table */
|
||||
memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
#endif /* ZEND_ENGINE_2 */
|
||||
|
||||
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
|
||||
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ fileinfo_module_entry
|
||||
*/
|
||||
zend_module_entry fileinfo_module_entry = {
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
STANDARD_MODULE_HEADER,
|
||||
#endif
|
||||
"fileinfo",
|
||||
fileinfo_functions,
|
||||
PHP_MINIT(finfo),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
PHP_MINFO(fileinfo),
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
"0.1", /* Replace with version number for your extension */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#ifdef COMPILE_DL_FILEINFO
|
||||
ZEND_GET_MODULE(fileinfo)
|
||||
#endif
|
||||
|
||||
/* {{{ PHP_MINFO_FUNCTION
|
||||
*/
|
||||
PHP_MINFO_FUNCTION(fileinfo)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "fileinfo support", "enabled");
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource finfo_open([int options [, string arg]])
|
||||
Create a new fileinfo resource. */
|
||||
PHP_FUNCTION(finfo_open)
|
||||
{
|
||||
long options = MAGIC_NONE;
|
||||
char *file = PHP_DEFAULT_MAGIC_FILE;
|
||||
int file_len = 0;
|
||||
struct php_fileinfo *finfo;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
char resolved_path[MAXPATHLEN];
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &options, &file, &file_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (file_len) { /* user specified filed, perform open_basedir checks */
|
||||
if (!VCWD_REALPATH(file, resolved_path)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
file = resolved_path;
|
||||
|
||||
if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
finfo = emalloc(sizeof(struct php_fileinfo));
|
||||
|
||||
finfo->options = options;
|
||||
finfo->magic = magic_open(options);
|
||||
|
||||
if (finfo->magic == NULL) {
|
||||
efree(finfo);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (magic_load(finfo->magic, file) == -1) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database at '%s'.", file);
|
||||
efree(finfo);
|
||||
magic_close(finfo->magic);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (object) {
|
||||
FILEINFO_REGISTER_OBJECT(object, finfo);
|
||||
} else {
|
||||
ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto resource finfo_close(resource finfo)
|
||||
Close fileinfo resource. */
|
||||
PHP_FUNCTION(finfo_close)
|
||||
{
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfinfo) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
|
||||
zend_list_delete(Z_RESVAL_P(zfinfo));
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool finfo_set_flags(resource finfo, int options)
|
||||
Set libmagic configuration options. */
|
||||
PHP_FUNCTION(finfo_set_flags)
|
||||
{
|
||||
long options;
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
|
||||
if (object) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
FILEINFO_FROM_OBJECT(finfo, object);
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zfinfo, &options) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
}
|
||||
|
||||
FINFO_SET_OPTION(finfo->magic, options)
|
||||
finfo->options = options;
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
{
|
||||
long options = 0;
|
||||
char *buffer, *tmp, *ret_val;
|
||||
int buffer_len;
|
||||
struct php_fileinfo *finfo;
|
||||
zval *zfinfo, *zcontext = NULL;
|
||||
FILEINFO_DECLARE_INIT_OBJECT(object)
|
||||
|
||||
if (object) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbz", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
FILEINFO_FROM_OBJECT(finfo, object);
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|lbz", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
|
||||
}
|
||||
|
||||
/* Set options for the current file/buffer. */
|
||||
if (options) {
|
||||
FINFO_SET_OPTION(finfo->magic, options)
|
||||
}
|
||||
|
||||
if (mode) { /* file */
|
||||
/* determine if the file is a local file or remote URL */
|
||||
char *tmp2;
|
||||
php_stream_wrapper *wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_DC);
|
||||
if (wrap && wrap->is_url) {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
|
||||
#else
|
||||
php_stream_context *context = NULL;
|
||||
#endif
|
||||
php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb",
|
||||
ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
|
||||
if (!stream) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
buffer_len = php_stream_copy_to_mem(stream, &tmp, HOWMANY, 0);
|
||||
php_stream_close(stream);
|
||||
|
||||
if (buffer_len == 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else { /* local file */
|
||||
char resolved_path[MAXPATHLEN];
|
||||
if (!VCWD_REALPATH(buffer, resolved_path)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret_val = (char *) magic_file(finfo->magic, buffer);
|
||||
goto common;
|
||||
}
|
||||
} else { /* buffer */
|
||||
tmp = buffer;
|
||||
}
|
||||
|
||||
ret_val = (char *) magic_buffer(finfo->magic, tmp, buffer_len);
|
||||
if (mode) {
|
||||
efree(tmp);
|
||||
}
|
||||
common:
|
||||
/* Restore options */
|
||||
if (options) {
|
||||
FINFO_SET_OPTION(finfo->magic, finfo->options)
|
||||
}
|
||||
|
||||
if (!ret_val) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify data %d:%s",
|
||||
magic_errno(finfo->magic), magic_error(finfo->magic));
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
RETURN_STRING(ret_val, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ proto string finfo_file(resource finfo, char *file_name [, int options [, resource context]])
|
||||
Return information about a file. */
|
||||
PHP_FUNCTION(finfo_file)
|
||||
{
|
||||
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string finfo_buffer(resource finfo, char *string [, int options])
|
||||
Return infromation about a string buffer. */
|
||||
PHP_FUNCTION(finfo_buffer)
|
||||
{
|
||||
_php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
if(!extension_loaded('fileinfo')) {
|
||||
dl('fileinfo.' . PHP_SHLIB_SUFFIX);
|
||||
}
|
||||
if(!extension_loaded('fileinfo')) {
|
||||
die("fileinfo extension is not avaliable, please compile it.\n");
|
||||
}
|
||||
|
||||
// normal operation
|
||||
$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
|
||||
$files = glob("*");
|
||||
foreach ($files as $file) {
|
||||
echo finfo_file($res, $file) . "\n";
|
||||
}
|
||||
finfo_close($res);
|
||||
|
||||
// OO mode
|
||||
/*
|
||||
* FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
|
||||
* FILEINFO_SYMLINK - follow symlinks
|
||||
* FILEINFO_DEVICES - look at the contents of blocks or character special devices
|
||||
* FILEINFO_COMPRESS - decompress compressed files
|
||||
*/
|
||||
$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
|
||||
$files = glob("*");
|
||||
foreach ($files as $file) {
|
||||
echo $fi->buffer(file_get_contents($file)) . "\n";
|
||||
}
|
||||
?>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE package SYSTEM "../pear/package.dtd">
|
||||
<package>
|
||||
<name>Fileinfo</name>
|
||||
<summary>libmagic bindings</summary>
|
||||
<maintainers>
|
||||
<maintainer>
|
||||
<user>iliaa</user>
|
||||
<name>Ilia Alshanetsky</name>
|
||||
<email>ilia@php.net</email>
|
||||
<role>lead</role>
|
||||
</maintainer>
|
||||
</maintainers>
|
||||
<description>
|
||||
This extension allows retrieval of information regarding vast majority of file.
|
||||
This information may include dimensions, quality, length etc...
|
||||
|
||||
Additionally it can also be used to retrieve the mime type for a particular
|
||||
file and for text files proper language encoding.
|
||||
</description>
|
||||
<license>PHP</license>
|
||||
<release>
|
||||
<state>beta</state>
|
||||
<version>0.2</version>
|
||||
<date>2004-05-26</date>
|
||||
<notes>
|
||||
Fixed bug that caused PHP to refuse to recognize fileinfo.so.
|
||||
</notes>
|
||||
<filelist>
|
||||
<file role="src" name="config.m4"/>
|
||||
<file role="src" name="fileinfo.c"/>
|
||||
<file role="src" name="php_fileinfo.h"/>
|
||||
<file role="doc" name="CREDITS"/>
|
||||
<file role="doc" name="EXPERIMENTAL"/>
|
||||
<file role="doc" name="fileinfo.php"/>
|
||||
</filelist>
|
||||
<deps>
|
||||
</deps>
|
||||
</release>
|
||||
</package>
|
||||
<!--
|
||||
vim:et:ts=1:sw=1
|
||||
-->
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Ilia Alshanetsky <ilia@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef PHP_FILEINFO_H
|
||||
#define PHP_FILEINFO_H
|
||||
|
||||
extern zend_module_entry fileinfo_module_entry;
|
||||
#define phpext_fileinfo_ptr &fileinfo_module_entry
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
#define PHP_FILEINFO_API __declspec(dllexport)
|
||||
#else
|
||||
#define PHP_FILEINFO_API
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
#include "TSRM.h"
|
||||
#endif
|
||||
|
||||
PHP_MINFO_FUNCTION(fileinfo);
|
||||
|
||||
PHP_FUNCTION(finfo_open);
|
||||
PHP_FUNCTION(finfo_close);
|
||||
PHP_FUNCTION(finfo_set_flags);
|
||||
PHP_FUNCTION(finfo_file);
|
||||
PHP_FUNCTION(finfo_buffer);
|
||||
|
||||
#ifdef ZTS
|
||||
#define FILEINFO_G(v) TSRMG(fileinfo_globals_id, zend_fileinfo_globals *, v)
|
||||
#else
|
||||
#define FILEINFO_G(v) (fileinfo_globals.v)
|
||||
#endif
|
||||
|
||||
#endif /* PHP_FILEINFO_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
+4
-1
@@ -259,6 +259,7 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
PHP_CHECK_LIBRARY(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdCacheCreate, [AC_DEFINE(HAVE_GD_CACHE_CREATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown, [AC_DEFINE(HAVE_GD_THREAD_SAFE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
|
||||
])
|
||||
|
||||
dnl
|
||||
@@ -272,7 +273,7 @@ if test "$PHP_GD" = "yes"; then
|
||||
libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
|
||||
libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \
|
||||
libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \
|
||||
libgd/xbm.c"
|
||||
libgd/xbm.c libgd/gd_gif_out.c "
|
||||
|
||||
dnl check for fabsf and floorf which are available since C99
|
||||
AC_CHECK_FUNCS(fabsf floorf)
|
||||
@@ -306,7 +307,9 @@ dnl These are always available with bundled library
|
||||
AC_DEFINE(HAVE_GD_XBM, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_IMAGEELLIPSE, 1, [ ])
|
||||
AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])
|
||||
|
||||
dnl Make sure the libgd/ is first in the include path
|
||||
GDLIB_CFLAGS="-DHAVE_LIBPNG"
|
||||
|
||||
+2
-1
@@ -13,7 +13,7 @@ if (PHP_GD != "no") {
|
||||
EXTENSION("gd", "gd.c gdttf.c", null, "-Iext/gd/libgd", "php_gd2.dll");
|
||||
ADD_SOURCES("ext/gd/libgd", "gd2copypal.c gd_arc_f_buggy.c gd.c \
|
||||
gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \
|
||||
gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gdhelpers.c gd_io.c gd_io_dp.c \
|
||||
gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gd_gif_out.c gdhelpers.c gd_io.c gd_io_dp.c \
|
||||
gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \
|
||||
gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c xbm.c", "gd");
|
||||
AC_DEFINE('HAVE_LIBGD', 1, 'GD support');
|
||||
@@ -21,6 +21,7 @@ if (PHP_GD != "no") {
|
||||
/D HAVE_GD_BUNDLED=1 \
|
||||
/D HAVE_GD_GD2 \
|
||||
/D HAVE_GD_GIF_READ=1 \
|
||||
/D HAVE_GD_GIF_CREATE=1 \
|
||||
/D HAVE_GDIMAGECOLORRESOLVE=1 \
|
||||
/D HAVE_GD_IMAGESETBRUSH=1 \
|
||||
/D HAVE_GD_IMAGESETTILE=1 \
|
||||
|
||||
+10
-5
@@ -35,6 +35,7 @@
|
||||
#include "SAPI.h"
|
||||
#include "php_gd.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_open_temporary_file.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
@@ -115,6 +116,10 @@ extern int gdImageColorResolve(gdImagePtr, int, int, int);
|
||||
int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GD_DYNAMIC_CTX_EX
|
||||
#define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data)
|
||||
#endif
|
||||
|
||||
/* Section Filters Declarations */
|
||||
/* IMPORTANT NOTE FOR NEW FILTER
|
||||
* Do not forget to update:
|
||||
@@ -453,7 +458,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
|
||||
/* }}} */
|
||||
|
||||
#if HAVE_GD_BUNDLED
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.23 compatible)"
|
||||
#define PHP_GD_VERSION_STRING "bundled (2.0.28 compatible)"
|
||||
#elif HAVE_LIBGD20
|
||||
#define PHP_GD_VERSION_STRING "2.0 or higher"
|
||||
#elif HAVE_GDIMAGECOLORRESOLVE
|
||||
@@ -1343,7 +1348,7 @@ static int _php_image_type (char data[8])
|
||||
#ifdef HAVE_GD_WBMP
|
||||
else {
|
||||
gdIOCtx *io_ctx;
|
||||
io_ctx = gdNewDynamicCtx(8, data);
|
||||
io_ctx = gdNewDynamicCtxEx(8, data, 0);
|
||||
if (io_ctx) {
|
||||
if (getmbi((int(*)(void *)) gdGetC, io_ctx) == 0 && skipheader((int(*)(void *)) gdGetC, io_ctx) == 0 ) {
|
||||
#if HAVE_LIBGD204
|
||||
@@ -1375,7 +1380,7 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc
|
||||
gdImagePtr im;
|
||||
gdIOCtx *io_ctx;
|
||||
|
||||
io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data), Z_STRVAL_PP(data));
|
||||
io_ctx = gdNewDynamicCtxEx(Z_STRLEN_PP(data), Z_STRVAL_PP(data), 0);
|
||||
|
||||
if (!io_ctx) {
|
||||
return NULL;
|
||||
@@ -1530,7 +1535,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
io_ctx = gdNewDynamicCtx(buff_size, buff);
|
||||
io_ctx = gdNewDynamicCtxEx(buff_size, buff, 0);
|
||||
if (!io_ctx) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context");
|
||||
goto out_err;
|
||||
@@ -1763,7 +1768,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
FILE *tmp;
|
||||
char buf[4096];
|
||||
|
||||
tmp = tmpfile();
|
||||
tmp = php_open_temporary_file("", "", NULL TSRMLS_CC);
|
||||
if (tmp == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file");
|
||||
RETURN_FALSE;
|
||||
|
||||
+8
-4
@@ -43,8 +43,8 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -73,8 +73,8 @@ LINK32=link.exe
|
||||
# PROP Intermediate_Dir "Debug_TS"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c
|
||||
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D "HAVE_GD_GD2" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
@@ -213,6 +213,10 @@ SOURCE=.\libgd\gd_gd2.c
|
||||
SOURCE=.\libgd\gd_gif_in.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_gif_out.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\libgd\gd_io.c
|
||||
|
||||
|
||||
@@ -407,8 +407,11 @@ void gdImageColorDeallocate(gdImagePtr im, int color);
|
||||
conversion to palette is not great (for small images
|
||||
it can be negative) and the quality loss is ugly. */
|
||||
|
||||
gdImagePtr gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
void gdImageTrueColorToPalette(gdImagePtr im, int ditherFlag, int colorsWanted);
|
||||
|
||||
|
||||
/* An attempt at getting the results of gdImageTrueColorToPalette
|
||||
to look a bit more like the original (im1 is the original
|
||||
and im2 is the palette version */
|
||||
@@ -428,6 +431,8 @@ void gdImageColorTransparent(gdImagePtr im, int color);
|
||||
void gdImagePaletteCopy(gdImagePtr dst, gdImagePtr src);
|
||||
void gdImagePng(gdImagePtr im, FILE *out);
|
||||
void gdImagePngCtx(gdImagePtr im, gdIOCtx *out);
|
||||
void gdImageGif(gdImagePtr im, FILE *out);
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
|
||||
/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
|
||||
* 1 is FASTEST but produces larger files, 9 provides the best
|
||||
* compression (smallest files) but takes a long time to compress, and
|
||||
|
||||
@@ -0,0 +1,759 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "gd.h"
|
||||
|
||||
/* Code drawn from ppmtogif.c, from the pbmplus package
|
||||
**
|
||||
** Based on GIFENCOD by David Rowley <mgardi@watdscu.waterloo.edu>. A
|
||||
** Lempel-Zim compression based on "compress".
|
||||
**
|
||||
** Modified by Marcel Wijkstra <wijkstra@fwi.uva.nl>
|
||||
**
|
||||
** Copyright (C) 1989 by Jef Poskanzer.
|
||||
**
|
||||
** Permission to use, copy, modify, and distribute this software and its
|
||||
** documentation for any purpose and without fee is hereby granted, provided
|
||||
** that the above copyright notice appear in all copies and that both that
|
||||
** copyright notice and this permission notice appear in supporting
|
||||
** documentation. This software is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
** The Graphics Interchange Format(c) is the Copyright property of
|
||||
** CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
** CompuServe Incorporated.
|
||||
*/
|
||||
|
||||
/*
|
||||
* a code_int must be able to hold 2**GIFBITS values of type int, and also -1
|
||||
*/
|
||||
typedef int code_int;
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
typedef unsigned long int count_int;
|
||||
typedef unsigned short int count_short;
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
typedef long int count_int;
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
/* 2.0.28: threadsafe */
|
||||
|
||||
#define maxbits GIFBITS
|
||||
|
||||
/* should NEVER generate this code */
|
||||
#define maxmaxcode ((code_int)1 << GIFBITS)
|
||||
|
||||
#define HSIZE 5003 /* 80% occupancy */
|
||||
#define hsize HSIZE /* Apparently invariant, left over from
|
||||
compress */
|
||||
|
||||
typedef struct {
|
||||
int Width, Height;
|
||||
int curx, cury;
|
||||
long CountDown;
|
||||
int Pass;
|
||||
int Interlace;
|
||||
int n_bits; /* number of bits/code */
|
||||
code_int maxcode; /* maximum code, given n_bits */
|
||||
count_int htab [HSIZE];
|
||||
unsigned short codetab [HSIZE];
|
||||
code_int free_ent; /* first unused entry */
|
||||
/*
|
||||
* block compression parameters -- after all codes are used up,
|
||||
* and compression rate changes, start over.
|
||||
*/
|
||||
int clear_flg;
|
||||
int offset;
|
||||
long int in_count; /* length of input */
|
||||
long int out_count; /* # of codes output (for debugging) */
|
||||
|
||||
int g_init_bits;
|
||||
gdIOCtx * g_outfile;
|
||||
|
||||
int ClearCode;
|
||||
int EOFCode;
|
||||
unsigned long cur_accum;
|
||||
int cur_bits;
|
||||
/*
|
||||
* Number of characters so far in this 'packet'
|
||||
*/
|
||||
int a_count;
|
||||
/*
|
||||
* Define the storage for the packet accumulator
|
||||
*/
|
||||
char accum[ 256 ];
|
||||
} GifCtx;
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out);
|
||||
static int colorstobpp(int colors);
|
||||
static void BumpPixel (GifCtx *ctx);
|
||||
static int GIFNextPixel (gdImagePtr im, GifCtx *ctx);
|
||||
static void GIFEncode (gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im);
|
||||
static void compress (int init_bits, gdIOCtx *outfile, gdImagePtr im, GifCtx *ctx);
|
||||
static void output (code_int code, GifCtx *ctx);
|
||||
static void cl_block (GifCtx *ctx);
|
||||
static void cl_hash (register count_int chsize, GifCtx *ctx);
|
||||
static void char_init (GifCtx *ctx);
|
||||
static void char_out (int c, GifCtx *ctx);
|
||||
static void flush_char (GifCtx *ctx);
|
||||
void * gdImageGifPtr (gdImagePtr im, int *size)
|
||||
{
|
||||
void *rv;
|
||||
gdIOCtx *out = gdNewDynamicCtx (2048, NULL);
|
||||
gdImageGifCtx (im, out);
|
||||
rv = gdDPExtractData (out, size);
|
||||
out->gd_free (out);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void gdImageGif (gdImagePtr im, FILE * outFile)
|
||||
{
|
||||
gdIOCtx *out = gdNewFileCtx (outFile);
|
||||
gdImageGifCtx (im, out);
|
||||
out->gd_free (out);
|
||||
}
|
||||
|
||||
void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
|
||||
{
|
||||
gdImagePtr pim = 0, tim = im;
|
||||
int interlace, transparent, BitsPerPixel;
|
||||
interlace = im->interlace;
|
||||
transparent = im->transparent;
|
||||
if (im->trueColor) {
|
||||
/* Expensive, but the only way that produces an
|
||||
acceptable result: mix down to a palette
|
||||
based temporary image. */
|
||||
pim = gdImageCreatePaletteFromTrueColor(im, 1, 256);
|
||||
if (!pim) {
|
||||
return;
|
||||
}
|
||||
tim = pim;
|
||||
}
|
||||
BitsPerPixel = colorstobpp(tim->colorsTotal);
|
||||
/* All set, let's do it. */
|
||||
GIFEncode(
|
||||
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel,
|
||||
tim->red, tim->green, tim->blue, tim);
|
||||
if (pim) {
|
||||
/* Destroy palette based temporary image. */
|
||||
gdImageDestroy( pim);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
colorstobpp(int colors)
|
||||
{
|
||||
int bpp = 0;
|
||||
|
||||
if ( colors <= 2 )
|
||||
bpp = 1;
|
||||
else if ( colors <= 4 )
|
||||
bpp = 2;
|
||||
else if ( colors <= 8 )
|
||||
bpp = 3;
|
||||
else if ( colors <= 16 )
|
||||
bpp = 4;
|
||||
else if ( colors <= 32 )
|
||||
bpp = 5;
|
||||
else if ( colors <= 64 )
|
||||
bpp = 6;
|
||||
else if ( colors <= 128 )
|
||||
bpp = 7;
|
||||
else if ( colors <= 256 )
|
||||
bpp = 8;
|
||||
return bpp;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* GIFENCODE.C - GIF Image compression interface
|
||||
*
|
||||
* GIFEncode( FName, GHeight, GWidth, GInterlace, Background, Transparent,
|
||||
* BitsPerPixel, Red, Green, Blue, gdImagePtr )
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/*
|
||||
* Bump the 'curx' and 'cury' to point to the next pixel
|
||||
*/
|
||||
static void
|
||||
BumpPixel(GifCtx *ctx)
|
||||
{
|
||||
/*
|
||||
* Bump the current X position
|
||||
*/
|
||||
++(ctx->curx);
|
||||
|
||||
/*
|
||||
* If we are at the end of a scan line, set curx back to the beginning
|
||||
* If we are interlaced, bump the cury to the appropriate spot,
|
||||
* otherwise, just increment it.
|
||||
*/
|
||||
if( ctx->curx == ctx->Width ) {
|
||||
ctx->curx = 0;
|
||||
|
||||
if( !ctx->Interlace )
|
||||
++(ctx->cury);
|
||||
else {
|
||||
switch( ctx->Pass ) {
|
||||
|
||||
case 0:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ctx->cury += 8;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ctx->cury += 4;
|
||||
if( ctx->cury >= ctx->Height ) {
|
||||
++(ctx->Pass);
|
||||
ctx->cury = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ctx->cury += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next pixel from the image
|
||||
*/
|
||||
static int
|
||||
GIFNextPixel(gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
int r;
|
||||
|
||||
if( ctx->CountDown == 0 )
|
||||
return EOF;
|
||||
|
||||
--(ctx->CountDown);
|
||||
|
||||
r = gdImageGetPixel(im, ctx->curx, ctx->cury);
|
||||
|
||||
BumpPixel(ctx);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* public */
|
||||
|
||||
static void
|
||||
GIFEncode(gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background, int Transparent, int BitsPerPixel, int *Red, int *Green, int *Blue, gdImagePtr im)
|
||||
{
|
||||
int B;
|
||||
int RWidth, RHeight;
|
||||
int LeftOfs, TopOfs;
|
||||
int Resolution;
|
||||
int ColorMapSize;
|
||||
int InitCodeSize;
|
||||
int i;
|
||||
GifCtx ctx;
|
||||
ctx.Interlace = GInterlace;
|
||||
ctx.in_count = 1;
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ColorMapSize = 1 << BitsPerPixel;
|
||||
|
||||
RWidth = ctx.Width = GWidth;
|
||||
RHeight = ctx.Height = GHeight;
|
||||
LeftOfs = TopOfs = 0;
|
||||
|
||||
Resolution = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Calculate number of bits we are expecting
|
||||
*/
|
||||
ctx.CountDown = (long)ctx.Width * (long)ctx.Height;
|
||||
|
||||
/*
|
||||
* Indicate which pass we are on (if interlace)
|
||||
*/
|
||||
ctx.Pass = 0;
|
||||
|
||||
/*
|
||||
* The initial code size
|
||||
*/
|
||||
if( BitsPerPixel <= 1 )
|
||||
InitCodeSize = 2;
|
||||
else
|
||||
InitCodeSize = BitsPerPixel;
|
||||
|
||||
/*
|
||||
* Set up the current x and y position
|
||||
*/
|
||||
ctx.curx = ctx.cury = 0;
|
||||
|
||||
/*
|
||||
* Write the Magic header
|
||||
*/
|
||||
gdPutBuf(Transparent < 0 ? "GIF87a" : "GIF89a", 6, fp );
|
||||
|
||||
/*
|
||||
* Write out the screen width and height
|
||||
*/
|
||||
gifPutWord( RWidth, fp );
|
||||
gifPutWord( RHeight, fp );
|
||||
|
||||
/*
|
||||
* Indicate that there is a global colour map
|
||||
*/
|
||||
B = 0x80; /* Yes, there is a color map */
|
||||
|
||||
/*
|
||||
* OR in the resolution
|
||||
*/
|
||||
B |= (Resolution - 1) << 5;
|
||||
|
||||
/*
|
||||
* OR in the Bits per Pixel
|
||||
*/
|
||||
B |= (BitsPerPixel - 1);
|
||||
|
||||
/*
|
||||
* Write it out
|
||||
*/
|
||||
gdPutC( B, fp );
|
||||
|
||||
/*
|
||||
* Write out the Background colour
|
||||
*/
|
||||
gdPutC( Background, fp );
|
||||
|
||||
/*
|
||||
* Byte of 0's (future expansion)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write out the Global Colour Map
|
||||
*/
|
||||
for( i=0; i<ColorMapSize; ++i ) {
|
||||
gdPutC( Red[i], fp );
|
||||
gdPutC( Green[i], fp );
|
||||
gdPutC( Blue[i], fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out extension for transparent colour index, if necessary.
|
||||
*/
|
||||
if ( Transparent >= 0 ) {
|
||||
gdPutC( '!', fp );
|
||||
gdPutC( 0xf9, fp );
|
||||
gdPutC( 4, fp );
|
||||
gdPutC( 1, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( 0, fp );
|
||||
gdPutC( (unsigned char) Transparent, fp );
|
||||
gdPutC( 0, fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Write an Image separator
|
||||
*/
|
||||
gdPutC( ',', fp );
|
||||
|
||||
/*
|
||||
* Write the Image header
|
||||
*/
|
||||
|
||||
gifPutWord( LeftOfs, fp );
|
||||
gifPutWord( TopOfs, fp );
|
||||
gifPutWord( ctx.Width, fp );
|
||||
gifPutWord( ctx.Height, fp );
|
||||
|
||||
/*
|
||||
* Write out whether or not the image is interlaced
|
||||
*/
|
||||
if( ctx.Interlace )
|
||||
gdPutC( 0x40, fp );
|
||||
else
|
||||
gdPutC( 0x00, fp );
|
||||
|
||||
/*
|
||||
* Write out the initial code size
|
||||
*/
|
||||
gdPutC( InitCodeSize, fp );
|
||||
|
||||
/*
|
||||
* Go and actually compress the data
|
||||
*/
|
||||
compress( InitCodeSize+1, fp, im, &ctx );
|
||||
|
||||
/*
|
||||
* Write out a Zero-length packet (to end the series)
|
||||
*/
|
||||
gdPutC( 0, fp );
|
||||
|
||||
/*
|
||||
* Write the GIF file terminator
|
||||
*/
|
||||
gdPutC( ';', fp );
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* GIFCOMPR.C - GIF Image compression routines
|
||||
*
|
||||
* Lempel-Ziv compression based on 'compress'. GIF modifications by
|
||||
* David Rowley (mgardi@watdcsu.waterloo.edu)
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* General DEFINEs
|
||||
*/
|
||||
|
||||
#define GIFBITS 12
|
||||
|
||||
#ifdef NO_UCHAR
|
||||
typedef char char_type;
|
||||
#else /*NO_UCHAR*/
|
||||
typedef unsigned char char_type;
|
||||
#endif /*NO_UCHAR*/
|
||||
|
||||
/*
|
||||
*
|
||||
* GIF Image compression - modified 'compress'
|
||||
*
|
||||
* Based on: compress.c - File compression ala IEEE Computer, June 1984.
|
||||
*
|
||||
* By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
|
||||
* Jim McKie (decvax!mcvax!jim)
|
||||
* Steve Davies (decvax!vax135!petsd!peora!srd)
|
||||
* Ken Turkowski (decvax!decwrl!turtlevax!ken)
|
||||
* James A. Woods (decvax!ihnp4!ames!jaw)
|
||||
* Joe Orost (decvax!vax135!petsd!joe)
|
||||
*
|
||||
*/
|
||||
#include <ctype.h>
|
||||
|
||||
#define ARGVAL() (*++(*argv) || (--argc && *++argv))
|
||||
|
||||
#ifdef COMPATIBLE /* But wrong! */
|
||||
# define MAXCODE(n_bits) ((code_int) 1 << (n_bits) - 1)
|
||||
#else /*COMPATIBLE*/
|
||||
# define MAXCODE(n_bits) (((code_int) 1 << (n_bits)) - 1)
|
||||
#endif /*COMPATIBLE*/
|
||||
|
||||
#define HashTabOf(i) ctx->htab[i]
|
||||
#define CodeTabOf(i) ctx->codetab[i]
|
||||
|
||||
|
||||
/*
|
||||
* To save much memory, we overlay the table used by compress() with those
|
||||
* used by decompress(). The tab_prefix table is the same size and type
|
||||
* as the codetab. The tab_suffix table needs 2**GIFBITS characters. We
|
||||
* get this from the beginning of htab. The output stack uses the rest
|
||||
* of htab, and contains characters. There is plenty of room for any
|
||||
* possible stack (stack used to be 8000 characters).
|
||||
*/
|
||||
|
||||
#define tab_prefixof(i) CodeTabOf(i)
|
||||
#define tab_suffixof(i) ((char_type*)(htab))[i]
|
||||
#define de_stack ((char_type*)&tab_suffixof((code_int)1<<GIFBITS))
|
||||
|
||||
/*
|
||||
* compress stdin to stdout
|
||||
*
|
||||
* Algorithm: use open addressing double hashing (no chaining) on the
|
||||
* prefix code / next character combination. We do a variant of Knuth's
|
||||
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
|
||||
* secondary probe. Here, the modular division first probe is gives way
|
||||
* to a faster exclusive-or manipulation. Also do block compression with
|
||||
* an adaptive reset, whereby the code table is cleared when the compression
|
||||
* ratio decreases, but after the table fills. The variable-length output
|
||||
* codes are re-sized at this point, and a special CLEAR code is generated
|
||||
* for the decompressor. Late addition: construct the table according to
|
||||
* file size for noticeable speed improvement on small files. Please direct
|
||||
* questions about this implementation to ames!jaw.
|
||||
*/
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx);
|
||||
|
||||
static void
|
||||
compress(int init_bits, gdIOCtxPtr outfile, gdImagePtr im, GifCtx *ctx)
|
||||
{
|
||||
register long fcode;
|
||||
register code_int i /* = 0 */;
|
||||
register int c;
|
||||
register code_int ent;
|
||||
register code_int disp;
|
||||
register code_int hsize_reg;
|
||||
register int hshift;
|
||||
|
||||
/*
|
||||
* Set up the globals: g_init_bits - initial number of bits
|
||||
* g_outfile - pointer to output file
|
||||
*/
|
||||
ctx->g_init_bits = init_bits;
|
||||
ctx->g_outfile = outfile;
|
||||
|
||||
/*
|
||||
* Set up the necessary values
|
||||
*/
|
||||
ctx->offset = 0;
|
||||
ctx->out_count = 0;
|
||||
ctx->clear_flg = 0;
|
||||
ctx->in_count = 1;
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits = ctx->g_init_bits);
|
||||
|
||||
ctx->ClearCode = (1 << (init_bits - 1));
|
||||
ctx->EOFCode = ctx->ClearCode + 1;
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
|
||||
char_init(ctx);
|
||||
|
||||
ent = GIFNextPixel( im, ctx );
|
||||
|
||||
hshift = 0;
|
||||
for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L )
|
||||
++hshift;
|
||||
hshift = 8 - hshift; /* set hash code range bound */
|
||||
|
||||
hsize_reg = hsize;
|
||||
cl_hash( (count_int) hsize_reg, ctx ); /* clear hash table */
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx );
|
||||
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
while ( (c = GIFNextPixel( im )) != (unsigned) EOF ) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
while ( (c = GIFNextPixel( im, ctx )) != EOF ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
|
||||
++(ctx->in_count);
|
||||
|
||||
fcode = (long) (((long) c << maxbits) + ent);
|
||||
i = (((code_int)c << hshift) ^ ent); /* xor hashing */
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
} else if ( (long)HashTabOf (i) < 0 ) /* empty slot */
|
||||
goto nomatch;
|
||||
disp = hsize_reg - i; /* secondary hash (after G. Knott) */
|
||||
if ( i == 0 )
|
||||
disp = 1;
|
||||
probe:
|
||||
if ( (i -= disp) < 0 )
|
||||
i += hsize_reg;
|
||||
|
||||
if ( HashTabOf (i) == fcode ) {
|
||||
ent = CodeTabOf (i);
|
||||
continue;
|
||||
}
|
||||
if ( (long)HashTabOf (i) > 0 )
|
||||
goto probe;
|
||||
nomatch:
|
||||
output ( (code_int) ent, ctx );
|
||||
++(ctx->out_count);
|
||||
ent = c;
|
||||
#ifdef SIGNED_COMPARE_SLOW
|
||||
if ( (unsigned) ctx->free_ent < (unsigned) maxmaxcode) {
|
||||
#else /*SIGNED_COMPARE_SLOW*/
|
||||
if ( ctx->free_ent < maxmaxcode ) { /* } */
|
||||
#endif /*SIGNED_COMPARE_SLOW*/
|
||||
CodeTabOf (i) = ctx->free_ent++; /* code -> hashtable */
|
||||
HashTabOf (i) = fcode;
|
||||
} else
|
||||
cl_block(ctx);
|
||||
}
|
||||
/*
|
||||
* Put out the final code.
|
||||
*/
|
||||
output( (code_int)ent, ctx );
|
||||
++(ctx->out_count);
|
||||
output( (code_int) ctx->EOFCode, ctx );
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* TAG( output )
|
||||
*
|
||||
* Output the given code.
|
||||
* Inputs:
|
||||
* code: A n_bits-bit integer. If == -1, then EOF. This assumes
|
||||
* that n_bits =< (long)wordsize - 1.
|
||||
* Outputs:
|
||||
* Outputs code to the file.
|
||||
* Assumptions:
|
||||
* Chars are 8 bits long.
|
||||
* Algorithm:
|
||||
* Maintain a GIFBITS character long buffer (so that 8 codes will
|
||||
* fit in it exactly). Use the VAX insv instruction to insert each
|
||||
* code in turn. When the buffer fills up empty it and start over.
|
||||
*/
|
||||
|
||||
static unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
|
||||
0x001F, 0x003F, 0x007F, 0x00FF,
|
||||
0x01FF, 0x03FF, 0x07FF, 0x0FFF,
|
||||
0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx)
|
||||
{
|
||||
ctx->cur_accum &= masks[ ctx->cur_bits ];
|
||||
|
||||
if( ctx->cur_bits > 0 )
|
||||
ctx->cur_accum |= ((long)code << ctx->cur_bits);
|
||||
else
|
||||
ctx->cur_accum = code;
|
||||
|
||||
ctx->cur_bits += ctx->n_bits;
|
||||
|
||||
while( ctx->cur_bits >= 8 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx );
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the next entry is going to be too big for the code size,
|
||||
* then increase it, if possible.
|
||||
*/
|
||||
if ( ctx->free_ent > ctx->maxcode || ctx->clear_flg ) {
|
||||
|
||||
if( ctx->clear_flg ) {
|
||||
|
||||
ctx->maxcode = MAXCODE (ctx->n_bits = ctx->g_init_bits);
|
||||
ctx->clear_flg = 0;
|
||||
|
||||
} else {
|
||||
|
||||
++(ctx->n_bits);
|
||||
if ( ctx->n_bits == maxbits )
|
||||
ctx->maxcode = maxmaxcode;
|
||||
else
|
||||
ctx->maxcode = MAXCODE(ctx->n_bits);
|
||||
}
|
||||
}
|
||||
|
||||
if( code == ctx->EOFCode ) {
|
||||
/*
|
||||
* At EOF, write the rest of the buffer.
|
||||
*/
|
||||
while( ctx->cur_bits > 0 ) {
|
||||
char_out( (unsigned int)(ctx->cur_accum & 0xff), ctx);
|
||||
ctx->cur_accum >>= 8;
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
flush_char(ctx);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear out the hash table
|
||||
*/
|
||||
static void
|
||||
cl_block (GifCtx *ctx) /* table clear for block compress */
|
||||
{
|
||||
|
||||
cl_hash ( (count_int) hsize, ctx );
|
||||
ctx->free_ent = ctx->ClearCode + 2;
|
||||
ctx->clear_flg = 1;
|
||||
|
||||
output( (code_int)ctx->ClearCode, ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cl_hash(register count_int chsize, GifCtx *ctx) /* reset code table */
|
||||
|
||||
{
|
||||
|
||||
register count_int *htab_p = ctx->htab+chsize;
|
||||
|
||||
register long i;
|
||||
register long m1 = -1;
|
||||
|
||||
i = chsize - 16;
|
||||
do { /* might use Sys V memset(3) here */
|
||||
*(htab_p-16) = m1;
|
||||
*(htab_p-15) = m1;
|
||||
*(htab_p-14) = m1;
|
||||
*(htab_p-13) = m1;
|
||||
*(htab_p-12) = m1;
|
||||
*(htab_p-11) = m1;
|
||||
*(htab_p-10) = m1;
|
||||
*(htab_p-9) = m1;
|
||||
*(htab_p-8) = m1;
|
||||
*(htab_p-7) = m1;
|
||||
*(htab_p-6) = m1;
|
||||
*(htab_p-5) = m1;
|
||||
*(htab_p-4) = m1;
|
||||
*(htab_p-3) = m1;
|
||||
*(htab_p-2) = m1;
|
||||
*(htab_p-1) = m1;
|
||||
htab_p -= 16;
|
||||
} while ((i -= 16) >= 0);
|
||||
|
||||
for ( i += 16; i > 0; --i )
|
||||
*--htab_p = m1;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* GIF Specific routines
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* Set up the 'byte output' routine
|
||||
*/
|
||||
static void
|
||||
char_init(GifCtx *ctx)
|
||||
{
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a character to the end of the current packet, and if it is 254
|
||||
* characters, flush the packet to disk.
|
||||
*/
|
||||
static void
|
||||
char_out(int c, GifCtx *ctx)
|
||||
{
|
||||
ctx->accum[ ctx->a_count++ ] = c;
|
||||
if( ctx->a_count >= 254 )
|
||||
flush_char(ctx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush the packet to disk, and reset the accumulator
|
||||
*/
|
||||
static void
|
||||
flush_char(GifCtx *ctx)
|
||||
{
|
||||
if( ctx->a_count > 0 ) {
|
||||
gdPutC( ctx->a_count, ctx->g_outfile );
|
||||
gdPutBuf( ctx->accum, ctx->a_count, ctx->g_outfile );
|
||||
ctx->a_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int gifPutWord(int w, gdIOCtx *out)
|
||||
{
|
||||
/* Byte order is little-endian */
|
||||
gdPutC(w & 0xFF, out);
|
||||
gdPutC((w >> 8) & 0xFF, out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1333
-1137
File diff suppressed because it is too large.
Load diff
@@ -27,7 +27,6 @@
|
||||
#if HAVE_LIBINTL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libintl.h>
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_gettext.h"
|
||||
|
||||
@@ -57,6 +56,8 @@ function_entry php_gettext_functions[] = {
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
#include <libintl.h>
|
||||
|
||||
zend_module_entry php_gettext_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"gettext",
|
||||
|
||||
@@ -12,6 +12,8 @@ if (PHP_ICONV != "no") {
|
||||
AC_DEFINE("HAVE_LIBICONV", 1, "Define if libiconv is available");
|
||||
AC_DEFINE("PHP_ICONV_IMPL", "\"libiconv\"", "Which iconv implementation to use");
|
||||
AC_DEFINE("ICONV_SUPPORTS_ERRNO", 1, "Whether iconv supports errno or not");
|
||||
if (!PHP_ICONV_SHARED) {
|
||||
ADD_DEF_FILE("ext\\iconv\\php_iconv.def");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+59
-24
@@ -2344,7 +2344,7 @@ static php_iconv_err_t php_iconv_stream_filter_ctor(php_iconv_stream_filter *sel
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_iconv_stream_filter_append_bucket */
|
||||
static size_t php_iconv_stream_filter_append_bucket(
|
||||
static int php_iconv_stream_filter_append_bucket(
|
||||
php_iconv_stream_filter *self,
|
||||
php_stream *stream, php_stream_filter *filter,
|
||||
php_stream_bucket_brigade *buckets_out,
|
||||
@@ -2367,7 +2367,11 @@ static size_t php_iconv_stream_filter_append_bucket(
|
||||
}
|
||||
|
||||
out_buf_size = ocnt = prev_ocnt = initial_out_buf_size;
|
||||
out_buf = pd = pemalloc(out_buf_size, self->persistent);
|
||||
if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
pd = out_buf;
|
||||
|
||||
if (self->stub_len > 0) {
|
||||
pt = self->stub;
|
||||
@@ -2407,14 +2411,26 @@ static size_t php_iconv_stream_filter_append_bucket(
|
||||
|
||||
if (new_out_buf_size < out_buf_size) {
|
||||
/* whoa! no bigger buckets are sold anywhere... */
|
||||
new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, self->persistent TSRMLS_CC);
|
||||
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
|
||||
goto out_failure;
|
||||
}
|
||||
|
||||
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
|
||||
|
||||
out_buf_size = ocnt = initial_out_buf_size;
|
||||
out_buf = pd = pemalloc(out_buf_size, self->persistent);
|
||||
if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
|
||||
return FAILURE;
|
||||
}
|
||||
pd = out_buf;
|
||||
} else {
|
||||
new_out_buf = perealloc(out_buf, new_out_buf_size, self->persistent);
|
||||
if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) {
|
||||
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
|
||||
goto out_failure;
|
||||
}
|
||||
|
||||
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
pd = new_out_buf + (pd - out_buf);
|
||||
ocnt += (new_out_buf_size - out_buf_size);
|
||||
out_buf = new_out_buf;
|
||||
@@ -2441,7 +2457,7 @@ static size_t php_iconv_stream_filter_append_bucket(
|
||||
|
||||
while (icnt > 0) {
|
||||
if ((ps == NULL ? iconv(self->cd, NULL, NULL, &pd, &ocnt):
|
||||
iconv(self->cd, &ps, &icnt, &pd, &ocnt)) == (size_t)-1) {
|
||||
iconv(self->cd, (char **)&ps, &icnt, &pd, &ocnt)) == (size_t)-1) {
|
||||
#if ICONV_SUPPORTS_ERRNO
|
||||
switch (errno) {
|
||||
case EILSEQ:
|
||||
@@ -2472,14 +2488,26 @@ static size_t php_iconv_stream_filter_append_bucket(
|
||||
|
||||
if (new_out_buf_size < out_buf_size) {
|
||||
/* whoa! no bigger buckets are sold anywhere... */
|
||||
new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, self->persistent TSRMLS_CC);
|
||||
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
|
||||
goto out_failure;
|
||||
}
|
||||
|
||||
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
|
||||
|
||||
out_buf_size = ocnt = initial_out_buf_size;
|
||||
out_buf = pd = pemalloc(out_buf_size, self->persistent);
|
||||
if (NULL == (out_buf = pemalloc(out_buf_size, persistent))) {
|
||||
return FAILURE;
|
||||
}
|
||||
pd = out_buf;
|
||||
} else {
|
||||
new_out_buf = perealloc(out_buf, new_out_buf_size, self->persistent);
|
||||
if (NULL == (new_out_buf = perealloc(out_buf, new_out_buf_size, persistent))) {
|
||||
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
|
||||
goto out_failure;
|
||||
}
|
||||
|
||||
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
pd = new_out_buf + (pd - out_buf);
|
||||
ocnt += (new_out_buf_size - out_buf_size);
|
||||
out_buf = new_out_buf;
|
||||
@@ -2506,17 +2534,19 @@ static size_t php_iconv_stream_filter_append_bucket(
|
||||
}
|
||||
|
||||
if (out_buf_size - ocnt > 0) {
|
||||
new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, self->persistent TSRMLS_CC);
|
||||
if (NULL == (new_bucket = php_stream_bucket_new(stream, out_buf, (out_buf_size - ocnt), 1, persistent TSRMLS_CC))) {
|
||||
goto out_failure;
|
||||
}
|
||||
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
|
||||
} else {
|
||||
pefree(out_buf, self->persistent);
|
||||
pefree(out_buf, persistent);
|
||||
}
|
||||
*consumed += buf_len - icnt;
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
out_failure:
|
||||
pefree(out_buf, self->persistent);
|
||||
pefree(out_buf, persistent);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -2531,27 +2561,32 @@ static php_stream_filter_status_t php_iconv_stream_filter_do_filter(
|
||||
size_t consumed = 0;
|
||||
php_iconv_stream_filter *self = (php_iconv_stream_filter *)filter->abstract;
|
||||
|
||||
if (flags != PSFS_FLAG_NORMAL) {
|
||||
if (php_iconv_stream_filter_append_bucket(self, stream, filter, buckets_out, NULL, 0, &consumed, self->persistent TSRMLS_CC) != SUCCESS) {
|
||||
while (buckets_in->head != NULL) {
|
||||
bucket = buckets_in->head;
|
||||
|
||||
php_stream_bucket_unlink(bucket TSRMLS_CC);
|
||||
|
||||
if (php_iconv_stream_filter_append_bucket(self, stream, filter,
|
||||
buckets_out, bucket->buf, bucket->buflen, &consumed,
|
||||
php_stream_is_persistent(stream) TSRMLS_CC) != SUCCESS) {
|
||||
goto out_failure;
|
||||
}
|
||||
} else {
|
||||
while (buckets_in->head != NULL) {
|
||||
bucket = buckets_in->head;
|
||||
|
||||
php_stream_bucket_unlink(bucket TSRMLS_CC);
|
||||
php_stream_bucket_delref(bucket TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (php_iconv_stream_filter_append_bucket(self, stream, filter, buckets_out, bucket->buf, bucket->buflen, &consumed, self->persistent TSRMLS_CC) != SUCCESS) { goto out_failure;
|
||||
}
|
||||
|
||||
php_stream_bucket_delref(bucket TSRMLS_CC);
|
||||
if (flags != PSFS_FLAG_NORMAL) {
|
||||
if (php_iconv_stream_filter_append_bucket(self, stream, filter,
|
||||
buckets_out, NULL, 0, &consumed,
|
||||
php_stream_is_persistent(stream) TSRMLS_CC) != SUCCESS) {
|
||||
goto out_failure;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes_consumed) {
|
||||
if (bytes_consumed != NULL) {
|
||||
*bytes_consumed = consumed;
|
||||
}
|
||||
|
||||
|
||||
return PSFS_PASS_ON;
|
||||
|
||||
out_failure:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
EXPORTS
|
||||
_libiconv_version
|
||||
libiconv_close
|
||||
libiconv
|
||||
libiconv_open
|
||||
libiconv_set_relocation_prefix
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
#ifndef _INCLUDED_IMAP_H
|
||||
#define _INCLUDED_IMAP_H
|
||||
|
||||
#if COMPILE_DL
|
||||
#undef HAVE_IMAP
|
||||
#define HAVE_IMAP 1
|
||||
#endif
|
||||
|
||||
#if HAVE_IMAP
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
#include "build-defs.h"
|
||||
#endif
|
||||
|
||||
/* Functions accessable to PHP */
|
||||
extern zend_module_entry imap_module_entry;
|
||||
#define imap_module_ptr &imap_module_entry
|
||||
|
||||
extern PHP_MINIT_FUNCTION(imap);
|
||||
extern PHP_RINIT_FUNCTION(imap);
|
||||
extern PHP_RSHUTDOWN_FUNCTION(imap);
|
||||
PHP_MINFO_FUNCTION(imap);
|
||||
PHP_FUNCTION(imap_open);
|
||||
PHP_FUNCTION(imap_popen);
|
||||
PHP_FUNCTION(imap_reopen);
|
||||
PHP_FUNCTION(imap_num_msg);
|
||||
PHP_FUNCTION(imap_num_recent);
|
||||
PHP_FUNCTION(imap_headers);
|
||||
PHP_FUNCTION(imap_headerinfo);
|
||||
PHP_FUNCTION(imap_rfc822_parse_headers);
|
||||
PHP_FUNCTION(imap_body);
|
||||
PHP_FUNCTION(imap_fetchstructure);
|
||||
PHP_FUNCTION(imap_fetchbody);
|
||||
PHP_FUNCTION(imap_expunge);
|
||||
PHP_FUNCTION(imap_delete);
|
||||
PHP_FUNCTION(imap_undelete);
|
||||
PHP_FUNCTION(imap_check);
|
||||
PHP_FUNCTION(imap_close);
|
||||
PHP_FUNCTION(imap_mail_copy);
|
||||
PHP_FUNCTION(imap_mail_move);
|
||||
PHP_FUNCTION(imap_createmailbox);
|
||||
PHP_FUNCTION(imap_renamemailbox);
|
||||
PHP_FUNCTION(imap_deletemailbox);
|
||||
PHP_FUNCTION(imap_listmailbox);
|
||||
PHP_FUNCTION(imap_scanmailbox);
|
||||
PHP_FUNCTION(imap_subscribe);
|
||||
PHP_FUNCTION(imap_unsubscribe);
|
||||
PHP_FUNCTION(imap_append);
|
||||
PHP_FUNCTION(imap_ping);
|
||||
PHP_FUNCTION(imap_base64);
|
||||
PHP_FUNCTION(imap_qprint);
|
||||
PHP_FUNCTION(imap_8bit);
|
||||
PHP_FUNCTION(imap_binary);
|
||||
PHP_FUNCTION(imap_mailboxmsginfo);
|
||||
PHP_FUNCTION(imap_rfc822_write_address);
|
||||
PHP_FUNCTION(imap_rfc822_parse_adrlist);
|
||||
PHP_FUNCTION(imap_setflag_full);
|
||||
PHP_FUNCTION(imap_clearflag_full);
|
||||
PHP_FUNCTION(imap_sort);
|
||||
PHP_FUNCTION(imap_fetchheader);
|
||||
PHP_FUNCTION(imap_fetchtext);
|
||||
PHP_FUNCTION(imap_uid);
|
||||
PHP_FUNCTION(imap_msgno);
|
||||
PHP_FUNCTION(imap_list);
|
||||
PHP_FUNCTION(imap_list_full);
|
||||
PHP_FUNCTION(imap_listscan);
|
||||
PHP_FUNCTION(imap_lsub);
|
||||
PHP_FUNCTION(imap_lsub_full);
|
||||
PHP_FUNCTION(imap_create);
|
||||
PHP_FUNCTION(imap_rename);
|
||||
PHP_FUNCTION(imap_status);
|
||||
PHP_FUNCTION(imap_bodystruct);
|
||||
PHP_FUNCTION(imap_fetch_overview);
|
||||
PHP_FUNCTION(imap_mail_compose);
|
||||
PHP_FUNCTION(imap_alerts);
|
||||
PHP_FUNCTION(imap_errors);
|
||||
PHP_FUNCTION(imap_last_error);
|
||||
PHP_FUNCTION(imap_mail);
|
||||
PHP_FUNCTION(imap_search);
|
||||
PHP_FUNCTION(imap_utf8);
|
||||
PHP_FUNCTION(imap_utf7_decode);
|
||||
PHP_FUNCTION(imap_utf7_encode);
|
||||
PHP_FUNCTION(imap_mime_header_decode);
|
||||
#else
|
||||
#define imap_module_ptr NULL
|
||||
#endif /* HAVE_IMAP */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define phpext_imap_ptr imap_module_ptr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+26
-24
@@ -112,7 +112,7 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_qprint, NULL)
|
||||
PHP_FE(imap_8bit, NULL)
|
||||
PHP_FE(imap_binary, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_utf8, NULL)
|
||||
PHP_FE(imap_status, NULL)
|
||||
PHP_FE(imap_mailboxmsginfo, NULL)
|
||||
PHP_FE(imap_setflag_full, NULL)
|
||||
@@ -131,24 +131,24 @@ function_entry imap_functions[] = {
|
||||
PHP_FE(imap_utf7_encode, NULL)
|
||||
PHP_FE(imap_mime_header_decode, NULL)
|
||||
PHP_FE(imap_thread, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
PHP_FE(imap_timeout, NULL)
|
||||
|
||||
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
|
||||
PHP_FE(imap_get_quota, NULL)
|
||||
PHP_FE(imap_get_quotaroot, NULL)
|
||||
PHP_FE(imap_set_quota, NULL)
|
||||
PHP_FE(imap_setacl, NULL)
|
||||
PHP_FE(imap_getacl, NULL)
|
||||
PHP_FE(imap_setacl, NULL)
|
||||
PHP_FE(imap_getacl, NULL)
|
||||
#endif
|
||||
|
||||
PHP_FE(imap_mail, NULL)
|
||||
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_header, imap_headerinfo, NULL)
|
||||
PHP_FALIAS(imap_listmailbox, imap_list, NULL)
|
||||
PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
|
||||
PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
|
||||
PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
|
||||
PHP_FALIAS(imap_fetchtext, imap_body, NULL)
|
||||
PHP_FALIAS(imap_scan, imap_listscan, NULL)
|
||||
PHP_FALIAS(imap_create, imap_createmailbox, NULL)
|
||||
@@ -182,6 +182,12 @@ ZEND_GET_MODULE(imap)
|
||||
/* True globals, no need for thread safety */
|
||||
static int le_imap;
|
||||
|
||||
#define PHP_IMAP_CHECK_MSGNO(msgindex) \
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number"); \
|
||||
RETURN_FALSE; \
|
||||
} \
|
||||
|
||||
/* {{{ mail_close_it
|
||||
*/
|
||||
static void mail_close_it(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
@@ -1529,11 +1535,8 @@ PHP_FUNCTION(imap_headerinfo)
|
||||
convert_to_string_ex(defaulthost);
|
||||
}
|
||||
|
||||
if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
|
||||
if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
|
||||
cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
|
||||
} else {
|
||||
@@ -1779,10 +1782,7 @@ PHP_FUNCTION(imap_fetchstructure)
|
||||
} else {
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
|
||||
mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
@@ -1816,7 +1816,12 @@ PHP_FUNCTION(imap_fetchbody)
|
||||
if (myargc == 4) {
|
||||
convert_to_long_ex(flags);
|
||||
}
|
||||
|
||||
|
||||
if (myargc < 4 || !(Z_LVAL_PP(flags) & FT_UID)) {
|
||||
/* only perform the check if the msgno is a message number and not a UID */
|
||||
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
|
||||
}
|
||||
|
||||
body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
|
||||
|
||||
if (!body) {
|
||||
@@ -2512,10 +2517,7 @@ PHP_FUNCTION(imap_fetchheader)
|
||||
msgindex = Z_LVAL_PP(msgno);
|
||||
}
|
||||
|
||||
if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message number");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
PHP_IMAP_CHECK_MSGNO(msgindex);
|
||||
|
||||
RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, (myargc == 3 ? Z_LVAL_PP(flags) : NIL)), 1);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ if (PHP_INFORMIX != "no") {
|
||||
|
||||
ADD_FLAG("CFLAGS_INFORMIX", "/I " + php_ifx_dir + "\\incl\\esql ");
|
||||
|
||||
EXTENSION('informix', 'ifx.c', null, "/D IFX_VERSION=921 /D HAVE_IFX_IUS=1", "php_ifx.dll");
|
||||
EXTENSION('informix', 'ifx.c', null, "/D IFX_VERSION=921 /D HAVE_IFX_IUS=1 /D HAVE_IFX=1", "php_ifx.dll");
|
||||
MFO.WriteLine(configure_module_dirname + "\\ifx.c: " + configure_module_dirname + "\\ifx.ec");
|
||||
MFO.WriteLine("\t<<informix_build.bat");
|
||||
MFO.WriteLine("PATH " + php_ifx_bin + ";%PATH%");
|
||||
|
||||
@@ -15,6 +15,7 @@ if (PHP_LIBXML == "yes") {
|
||||
if (!PHP_LIBXML_SHARED) {
|
||||
ADD_DEF_FILE("ext\\libxml\\php_libxml2.def");
|
||||
}
|
||||
ADD_EXTENSION_DEP('libxml', 'iconv');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+42
-8
@@ -253,15 +253,18 @@ int php_libxml_streams_IO_match_wrapper(const char *filename)
|
||||
|
||||
void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode, const int read_only)
|
||||
{
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
php_stream_statbuf ssbuf;
|
||||
php_stream_context *context = NULL;
|
||||
php_stream_wrapper *wrapper = NULL;
|
||||
char *path_to_open = NULL;
|
||||
char *resolved_path, *path_to_open = NULL;
|
||||
void *ret_val = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
xmlURIUnescapeString(filename, 0, resolved_path);
|
||||
path_to_open = resolved_path;
|
||||
resolved_path = xmlURIUnescapeString(filename, 0, NULL);
|
||||
|
||||
if (resolved_path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* logic copied from _php_stream_stat, but we only want to fail
|
||||
if the wrapper supports stat, otherwise, figure it out from
|
||||
@@ -272,15 +275,20 @@ void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode,
|
||||
wrapper = php_stream_locate_url_wrapper(resolved_path, &path_to_open, ENFORCE_SAFE_MODE TSRMLS_CC);
|
||||
if (wrapper && read_only && wrapper->wops->url_stat) {
|
||||
if (wrapper->wops->url_stat(wrapper, path_to_open, 0, &ssbuf, NULL TSRMLS_CC) == -1) {
|
||||
xmlFree(resolved_path);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (LIBXML(stream_context)) {
|
||||
context = zend_fetch_resource(&LIBXML(stream_context) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context());
|
||||
return php_stream_open_wrapper_ex((char *)resolved_path, (char *)mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL, context);
|
||||
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL, context);
|
||||
xmlFree(resolved_path);
|
||||
return ret_val;
|
||||
}
|
||||
return php_stream_open_wrapper((char *)resolved_path, (char *)mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
|
||||
ret_val = php_stream_open_wrapper(path_to_open, (char *)mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
|
||||
xmlFree(resolved_path);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
void *php_libxml_streams_IO_open_read_wrapper(const char *filename)
|
||||
@@ -377,7 +385,7 @@ void php_libxml_ctx_warning(void *ctx, const char *msg, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void php_libxml_error_handler(void *ctx, const char *msg, ...)
|
||||
PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
@@ -497,6 +505,32 @@ PHP_FUNCTION(libxml_set_streams_context)
|
||||
|
||||
|
||||
/* {{{ Common functions shared by extensions */
|
||||
int php_libxml_xmlCheckUTF8(const unsigned char *s)
|
||||
{
|
||||
int i;
|
||||
unsigned char c;
|
||||
|
||||
for (i = 0; (c = s[i++]);) {
|
||||
if ((c & 0x80) == 0) {
|
||||
} else if ((c & 0xe0) == 0xc0) {
|
||||
if ((s[i++] & 0xc0) != 0x80) {
|
||||
return 0;
|
||||
}
|
||||
} else if ((c & 0xf0) == 0xe0) {
|
||||
if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) {
|
||||
return 0;
|
||||
}
|
||||
} else if ((c & 0xf8) == 0xf0) {
|
||||
if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function)
|
||||
{
|
||||
php_libxml_func_handler export_hnd;
|
||||
@@ -568,7 +602,7 @@ int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC) {
|
||||
obj_node = (php_libxml_node_ptr *) object->node;
|
||||
ret_refcount = --obj_node->refcount;
|
||||
if (ret_refcount == 0) {
|
||||
if (obj_node->node != NULL && obj_node->node->type != XML_DOCUMENT_NODE) {
|
||||
if (obj_node->node != NULL) {
|
||||
obj_node->node->_private = NULL;
|
||||
}
|
||||
efree(obj_node);
|
||||
|
||||
@@ -77,9 +77,10 @@ PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_e
|
||||
void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
|
||||
/* When object dtor is called as node may still be referenced */
|
||||
void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
|
||||
void php_libxml_error_handler(void *ctx, const char *msg, ...);
|
||||
PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
|
||||
void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
|
||||
void php_libxml_ctx_error(void *ctx, const char *msg, ...);
|
||||
PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
|
||||
|
||||
#endif /* HAVE_LIBXML */
|
||||
|
||||
|
||||
+339
-6
@@ -13,13 +13,22 @@ __xmlGenericError
|
||||
__xmlGenericErrorContext
|
||||
__xmlGetWarningsDefaultValue
|
||||
__xmlIndentTreeOutput
|
||||
xmlIsBaseCharGroup DATA
|
||||
xmlIsCharGroup DATA
|
||||
xmlIsCombiningGroup DATA
|
||||
xmlIsDigitGroup DATA
|
||||
xmlIsExtenderGroup DATA
|
||||
xmlIsIdeographicGroup DATA
|
||||
xmlIsPubidChar_tab DATA
|
||||
__xmlKeepBlanksDefaultValue
|
||||
xmlLastError DATA
|
||||
__xmlLineNumbersDefaultValue
|
||||
__xmlLoadExtDtdDefaultValue
|
||||
xmlMalloc DATA
|
||||
xmlMallocAtomic DATA
|
||||
xmlMemStrdup DATA
|
||||
__xmlParserDebugEntities
|
||||
xmlParserMaxDepth DATA
|
||||
__xmlParserVersion
|
||||
__xmlPedanticParserDefaultValue
|
||||
xmlRealloc DATA
|
||||
@@ -28,6 +37,7 @@ __xmlSaveNoEmptyTags
|
||||
xmlStringComment DATA
|
||||
xmlStringText DATA
|
||||
xmlStringTextNoenc DATA
|
||||
xmlStructuredError DATA
|
||||
__xmlSubstituteEntitiesDefaultValue
|
||||
__xmlTreeIndentString
|
||||
xmlXPathNAN DATA
|
||||
@@ -72,6 +82,13 @@ htmlAutoCloseTag
|
||||
htmlCreateFileParserCtxt
|
||||
htmlCreateMemoryParserCtxt
|
||||
htmlCreatePushParserCtxt
|
||||
htmlCtxtReadDoc
|
||||
htmlCtxtReadFd
|
||||
htmlCtxtReadFile
|
||||
htmlCtxtReadIO
|
||||
htmlCtxtReadMemory
|
||||
htmlCtxtReset
|
||||
htmlCtxtUseOptions
|
||||
htmlDefaultSAXHandlerInit
|
||||
htmlDocContentDumpFormatOutput
|
||||
htmlDocContentDumpOutput
|
||||
@@ -104,6 +121,11 @@ htmlParseDocument
|
||||
htmlParseElement
|
||||
htmlParseEntityRef
|
||||
htmlParseFile
|
||||
htmlReadDoc
|
||||
htmlReadFd
|
||||
htmlReadFile
|
||||
htmlReadIO
|
||||
htmlReadMemory
|
||||
htmlSAXParseDoc
|
||||
htmlSAXParseFile
|
||||
htmlSaveFile
|
||||
@@ -159,6 +181,7 @@ xmlAddRef
|
||||
xmlAddSibling
|
||||
xmlAllocOutputBuffer
|
||||
xmlAllocParserInputBuffer
|
||||
xmlAttrSerializeTxtContent
|
||||
xmlAutomataCompile
|
||||
xmlAutomataGetInitState
|
||||
xmlAutomataIsDeterminist
|
||||
@@ -181,6 +204,7 @@ xmlBufferCat
|
||||
xmlBufferContent
|
||||
xmlBufferCreate
|
||||
xmlBufferCreateSize
|
||||
xmlBufferCreateStatic
|
||||
xmlBufferDump
|
||||
xmlBufferEmpty
|
||||
xmlBufferFree
|
||||
@@ -194,6 +218,7 @@ xmlBufferWriteChar
|
||||
xmlBufferWriteQuotedString
|
||||
xmlBuildQName
|
||||
xmlBuildURI
|
||||
xmlByteConsumed
|
||||
xmlC14NDocDumpMemory
|
||||
xmlC14NDocSave
|
||||
xmlC14NDocSaveTo
|
||||
@@ -223,9 +248,11 @@ xmlCharEncCloseFunc
|
||||
xmlCharEncFirstLine
|
||||
xmlCharEncInFunc
|
||||
xmlCharEncOutFunc
|
||||
xmlCharInRange
|
||||
xmlCharStrdup
|
||||
xmlCharStrndup
|
||||
xmlCheckFilename
|
||||
xmlCheckHTTPInput
|
||||
xmlCheckLanguageID
|
||||
xmlCheckUTF8
|
||||
xmlCheckVersion
|
||||
@@ -233,6 +260,7 @@ xmlCleanupCharEncodingHandlers
|
||||
xmlCleanupEncodingAliases
|
||||
xmlCleanupGlobals
|
||||
xmlCleanupInputCallbacks
|
||||
xmlCleanupMemory
|
||||
xmlCleanupOutputCallbacks
|
||||
xmlCleanupParser
|
||||
xmlCleanupPredefinedEntities
|
||||
@@ -249,6 +277,7 @@ xmlCopyElementContent
|
||||
xmlCopyElementTable
|
||||
xmlCopyEntitiesTable
|
||||
xmlCopyEnumeration
|
||||
xmlCopyError
|
||||
xmlCopyNamespace
|
||||
xmlCopyNamespaceList
|
||||
xmlCopyNode
|
||||
@@ -266,7 +295,26 @@ xmlCreateIntSubset
|
||||
xmlCreateMemoryParserCtxt
|
||||
xmlCreatePushParserCtxt
|
||||
xmlCreateURI
|
||||
xmlCreateURLParserCtxt
|
||||
xmlCtxtGetLastError
|
||||
xmlCtxtReadDoc
|
||||
xmlCtxtReadFd
|
||||
xmlCtxtReadFile
|
||||
xmlCtxtReadIO
|
||||
xmlCtxtReadMemory
|
||||
xmlCtxtReset
|
||||
xmlCtxtResetLastError
|
||||
xmlCtxtResetPush
|
||||
xmlCtxtUseOptions
|
||||
xmlCurrentChar
|
||||
xmlDictCreate
|
||||
xmlDictCreateSub
|
||||
xmlDictFree
|
||||
xmlDictLookup
|
||||
xmlDictOwns
|
||||
xmlDictQLookup
|
||||
xmlDictReference
|
||||
xmlDictSize
|
||||
xmlDebugDumpAttr
|
||||
xmlDebugDumpAttrList
|
||||
xmlDebugDumpDTD
|
||||
@@ -282,6 +330,14 @@ xmlDefaultSAXHandlerInit
|
||||
xmlDelEncodingAlias
|
||||
xmlDeregisterNodeDefault
|
||||
xmlDetectCharEncoding
|
||||
xmlDictCreate
|
||||
xmlDictCreateSub
|
||||
xmlDictFree
|
||||
xmlDictLookup
|
||||
xmlDictOwns
|
||||
xmlDictQLookup
|
||||
xmlDictReference
|
||||
xmlDictSize
|
||||
xmlDocCopyNode
|
||||
xmlDocDump
|
||||
xmlDocDumpFormatMemory
|
||||
@@ -303,6 +359,7 @@ xmlElemDump
|
||||
xmlEncodeEntities
|
||||
xmlEncodeEntitiesReentrant
|
||||
xmlEncodeSpecialChars
|
||||
xmlErrMemory
|
||||
xmlFileClose
|
||||
xmlFileMatch
|
||||
xmlFileOpen
|
||||
@@ -327,11 +384,14 @@ xmlFreeNs
|
||||
xmlFreeNsList
|
||||
xmlFreeParserCtxt
|
||||
xmlFreeParserInputBuffer
|
||||
xmlFreePattern
|
||||
xmlFreePatternList
|
||||
xmlFreeProp
|
||||
xmlFreePropList
|
||||
xmlFreeRMutex
|
||||
xmlFreeRefTable
|
||||
xmlFreeTextReader
|
||||
xmlFreeTextWriter
|
||||
xmlFreeURI
|
||||
xmlFreeValidCtxt
|
||||
xmlGcMemGet
|
||||
@@ -356,6 +416,7 @@ xmlGetGlobalState
|
||||
xmlGetID
|
||||
xmlGetIntSubset
|
||||
xmlGetLastChild
|
||||
xmlGetLastError
|
||||
xmlGetLineNo
|
||||
xmlGetNoNsProp
|
||||
xmlGetNodePath
|
||||
@@ -379,6 +440,9 @@ xmlHashFree
|
||||
xmlHashLookup
|
||||
xmlHashLookup2
|
||||
xmlHashLookup3
|
||||
xmlHashQLookup
|
||||
xmlHashQLookup2
|
||||
xmlHashQLookup3
|
||||
xmlHashRemoveEntry
|
||||
xmlHashRemoveEntry2
|
||||
xmlHashRemoveEntry3
|
||||
@@ -425,6 +489,12 @@ xmlIsMixedElement
|
||||
xmlIsPubidChar
|
||||
xmlIsRef
|
||||
xmlIsXHTML
|
||||
xmlIsBaseCharGroup DATA
|
||||
xmlIsCharGroup DATA
|
||||
xmlIsCombiningGroup DATA
|
||||
xmlIsDigitGroup DATA
|
||||
xmlIsExtenderGroup DATA
|
||||
xmlIsIdeographicGroup DATA
|
||||
xmlKeepBlanksDefault
|
||||
xmlLineNumbersDefault
|
||||
xmlLinkGetData
|
||||
@@ -461,6 +531,8 @@ xmlLoadSGMLSuperCatalog
|
||||
xmlLockLibrary
|
||||
xmlLsCountNode
|
||||
xmlLsOneNode
|
||||
xmlMallocAtomicLoc
|
||||
xmlMallocLoc
|
||||
xmlMemDisplay
|
||||
xmlMemFree
|
||||
xmlMemGet
|
||||
@@ -468,6 +540,7 @@ xmlMemMalloc
|
||||
xmlMemRealloc
|
||||
xmlMemSetup
|
||||
xmlMemShow
|
||||
xmlMemStrdupLoc
|
||||
xmlMemUsed
|
||||
xmlMemoryDump
|
||||
xmlMemoryStrdup
|
||||
@@ -501,13 +574,16 @@ xmlNanoFTPUpdateURL
|
||||
xmlNanoHTTPAuthHeader
|
||||
xmlNanoHTTPCleanup
|
||||
xmlNanoHTTPClose
|
||||
xmlNanoHTTPEncoding
|
||||
xmlNanoHTTPFetch
|
||||
xmlNanoHTTPInit
|
||||
xmlNanoHTTPMethod
|
||||
xmlNanoHTTPMethodRedir
|
||||
xmlNanoHTTPMimeType
|
||||
xmlNanoHTTPOpen
|
||||
xmlNanoHTTPOpenRedir
|
||||
xmlNanoHTTPRead
|
||||
xmlNanoHTTPRedir
|
||||
xmlNanoHTTPReturnCode
|
||||
xmlNanoHTTPSave
|
||||
xmlNanoHTTPScanProxy
|
||||
@@ -551,11 +627,18 @@ xmlNewTextChild
|
||||
xmlNewTextLen
|
||||
xmlNewTextReader
|
||||
xmlNewTextReaderFilename
|
||||
xmlNewTextWriter
|
||||
xmlNewTextWriterDoc
|
||||
xmlNewTextWriterFilename
|
||||
xmlNewTextWriterMemory
|
||||
xmlNewTextWriterPushParser
|
||||
xmlNewTextWriterTree
|
||||
xmlNewValidCtxt
|
||||
xmlNextChar
|
||||
xmlNoNetExternalEntityLoader
|
||||
xmlNodeAddContent
|
||||
xmlNodeAddContentLen
|
||||
xmlNodeBufGetContent
|
||||
xmlNodeDump
|
||||
xmlNodeDumpOutput
|
||||
xmlNodeGetBase
|
||||
@@ -655,6 +738,7 @@ xmlParserInputBufferCreateFile
|
||||
xmlParserInputBufferCreateFilename
|
||||
xmlParserInputBufferCreateIO
|
||||
xmlParserInputBufferCreateMem
|
||||
xmlParserInputBufferCreateStatic
|
||||
xmlParserInputBufferGrow
|
||||
xmlParserInputBufferPush
|
||||
xmlParserInputBufferRead
|
||||
@@ -666,12 +750,32 @@ xmlParserPrintFileInfo
|
||||
xmlParserValidityError
|
||||
xmlParserValidityWarning
|
||||
xmlParserWarning
|
||||
xmlPatternMatch
|
||||
xmlPatterncompile
|
||||
xmlPedanticParserDefault
|
||||
xmlPopInput
|
||||
xmlPrintURI
|
||||
xmlPushInput
|
||||
xmlRMutexLock
|
||||
xmlRMutexUnlock
|
||||
xmlReadDoc
|
||||
xmlReadFd
|
||||
xmlReadFile
|
||||
xmlReadIO
|
||||
xmlReadMemory
|
||||
xmlReaderForDoc
|
||||
xmlReaderForFd
|
||||
xmlReaderForFile
|
||||
xmlReaderForIO
|
||||
xmlReaderForMemory
|
||||
xmlReaderNewDoc
|
||||
xmlReaderNewFd
|
||||
xmlReaderNewFile
|
||||
xmlReaderNewIO
|
||||
xmlReaderNewMemory
|
||||
xmlReaderNewWalker
|
||||
xmlReaderWalker
|
||||
xmlReallocLoc
|
||||
xmlReconciliateNs
|
||||
xmlRecoverDoc
|
||||
xmlRecoverFile
|
||||
@@ -712,10 +816,47 @@ xmlRelaxNGValidateFullElement
|
||||
xmlRelaxNGValidatePopElement
|
||||
xmlRelaxNGValidatePushCData
|
||||
xmlRelaxNGValidatePushElement
|
||||
xmlRelaxParserSetFlag
|
||||
xmlRemoveID
|
||||
xmlRemoveProp
|
||||
xmlRemoveRef
|
||||
xmlReplaceNode
|
||||
xmlResetError
|
||||
xmlResetLastError
|
||||
xmlSAX2AttributeDecl
|
||||
xmlSAX2CDataBlock
|
||||
xmlSAX2Characters
|
||||
xmlSAX2Comment
|
||||
xmlSAX2ElementDecl
|
||||
xmlSAX2EndDocument
|
||||
xmlSAX2EndElement
|
||||
xmlSAX2EndElementNs
|
||||
xmlSAX2EntityDecl
|
||||
xmlSAX2ExternalSubset
|
||||
xmlSAX2GetColumnNumber
|
||||
xmlSAX2GetEntity
|
||||
xmlSAX2GetLineNumber
|
||||
xmlSAX2GetParameterEntity
|
||||
xmlSAX2GetPublicId
|
||||
xmlSAX2GetSystemId
|
||||
xmlSAX2HasExternalSubset
|
||||
xmlSAX2HasInternalSubset
|
||||
xmlSAX2IgnorableWhitespace
|
||||
xmlSAX2InitDefaultSAXHandler
|
||||
xmlSAX2InitDocbDefaultSAXHandler
|
||||
xmlSAX2InitHtmlDefaultSAXHandler
|
||||
xmlSAX2InternalSubset
|
||||
xmlSAX2IsStandalone
|
||||
xmlSAX2NotationDecl
|
||||
xmlSAX2ProcessingInstruction
|
||||
xmlSAX2Reference
|
||||
xmlSAX2ResolveEntity
|
||||
xmlSAX2SetDocumentLocator
|
||||
xmlSAX2StartDocument
|
||||
xmlSAX2StartElement
|
||||
xmlSAX2StartElementNs
|
||||
xmlSAX2UnparsedEntityDecl
|
||||
xmlSAXDefaultVersion
|
||||
xmlSAXParseDTD
|
||||
xmlSAXParseDoc
|
||||
xmlSAXParseEntity
|
||||
@@ -725,6 +866,7 @@ xmlSAXParseMemory
|
||||
xmlSAXParseMemoryWithData
|
||||
xmlSAXUserParseFile
|
||||
xmlSAXUserParseMemory
|
||||
xmlSAXVersion
|
||||
xmlSaveFile
|
||||
xmlSaveFileEnc
|
||||
xmlSaveFileTo
|
||||
@@ -745,6 +887,7 @@ xmlSchemaFreeValidCtxt
|
||||
xmlSchemaFreeValue
|
||||
xmlSchemaGetPredefinedType
|
||||
xmlSchemaInitTypes
|
||||
xmlSchemaNewDocParserCtxt
|
||||
xmlSchemaNewFacet
|
||||
xmlSchemaNewMemParserCtxt
|
||||
xmlSchemaNewParserCtxt
|
||||
@@ -770,6 +913,7 @@ xmlSetListDoc
|
||||
xmlSetNs
|
||||
xmlSetNsProp
|
||||
xmlSetProp
|
||||
xmlSetStructuredErrorFunc
|
||||
xmlSetTreeDoc
|
||||
xmlSetupParserForBuffer
|
||||
xmlShell
|
||||
@@ -794,6 +938,9 @@ xmlSplitQName3
|
||||
xmlSprintfElementContent
|
||||
xmlStopParser
|
||||
xmlStrEqual
|
||||
xmlStrPrintf
|
||||
xmlStrQEqual
|
||||
xmlStrVPrintf
|
||||
xmlStrcasecmp
|
||||
xmlStrcasestr
|
||||
xmlStrcat
|
||||
@@ -803,22 +950,33 @@ xmlStrdup
|
||||
xmlStringCurrentChar
|
||||
xmlStringDecodeEntities
|
||||
xmlStringGetNodeList
|
||||
xmlStringLenDecodeEntities
|
||||
xmlStringLenGetNodeList
|
||||
xmlStrlen
|
||||
xmlStrncasecmp
|
||||
xmlStrncat
|
||||
xmlStrncatNew
|
||||
xmlStrncmp
|
||||
xmlStrndup
|
||||
xmlStrstr
|
||||
xmlStrsub
|
||||
xmlSubstituteEntitiesDefault
|
||||
xmlSwitchEncoding
|
||||
xmlSwitchInputEncoding
|
||||
xmlSwitchToEncoding
|
||||
xmlTextConcat
|
||||
xmlTextMerge
|
||||
xmlTextReaderAttributeCount
|
||||
xmlTextReaderBaseUri
|
||||
xmlTextReaderClose
|
||||
xmlTextReaderConstBaseUri
|
||||
xmlTextReaderConstLocalName
|
||||
xmlTextReaderConstName
|
||||
xmlTextReaderConstNamespaceUri
|
||||
xmlTextReaderConstPrefix
|
||||
xmlTextReaderConstString
|
||||
xmlTextReaderConstValue
|
||||
xmlTextReaderConstXmlLang
|
||||
xmlTextReaderCurrentDoc
|
||||
xmlTextReaderCurrentNode
|
||||
xmlTextReaderDepth
|
||||
@@ -847,9 +1005,12 @@ xmlTextReaderMoveToNextAttribute
|
||||
xmlTextReaderName
|
||||
xmlTextReaderNamespaceUri
|
||||
xmlTextReaderNext
|
||||
xmlTextReaderNextSibling
|
||||
xmlTextReaderNodeType
|
||||
xmlTextReaderNormalization
|
||||
xmlTextReaderPrefix
|
||||
xmlTextReaderPreserve
|
||||
xmlTextReaderPreservePattern
|
||||
xmlTextReaderQuoteChar
|
||||
xmlTextReaderRead
|
||||
xmlTextReaderReadAttributeValue
|
||||
@@ -861,8 +1022,77 @@ xmlTextReaderRelaxNGSetSchema
|
||||
xmlTextReaderRelaxNGValidate
|
||||
xmlTextReaderSetErrorHandler
|
||||
xmlTextReaderSetParserProp
|
||||
xmlTextReaderSetStructuredErrorHandler
|
||||
xmlTextReaderValue
|
||||
xmlTextReaderXmlLang
|
||||
xmlTextWriterEndAttribute
|
||||
xmlTextWriterEndCDATA
|
||||
xmlTextWriterEndComment
|
||||
xmlTextWriterEndDTD
|
||||
xmlTextWriterEndDocument
|
||||
xmlTextWriterEndElement
|
||||
xmlTextWriterEndPI
|
||||
xmlTextWriterFlush
|
||||
xmlTextWriterFullEndElement
|
||||
xmlTextWriterSetIndent
|
||||
xmlTextWriterSetIndentString
|
||||
xmlTextWriterStartAttribute
|
||||
xmlTextWriterStartAttributeNS
|
||||
xmlTextWriterStartCDATA
|
||||
xmlTextWriterStartComment
|
||||
xmlTextWriterStartDTD
|
||||
xmlTextWriterStartDTDAttlist
|
||||
xmlTextWriterStartDTDElement
|
||||
xmlTextWriterStartDTDEntity
|
||||
xmlTextWriterStartDocument
|
||||
xmlTextWriterStartElement
|
||||
xmlTextWriterStartElementNS
|
||||
xmlTextWriterStartPI
|
||||
xmlTextWriterWriteAttribute
|
||||
xmlTextWriterWriteAttributeNS
|
||||
xmlTextWriterWriteBase64
|
||||
xmlTextWriterWriteBinHex
|
||||
xmlTextWriterWriteCDATA
|
||||
xmlTextWriterWriteComment
|
||||
xmlTextWriterWriteDTD
|
||||
xmlTextWriterWriteDTDAttlist
|
||||
xmlTextWriterWriteDTDElement
|
||||
xmlTextWriterWriteDTDEntity
|
||||
xmlTextWriterWriteDTDExternalEntity
|
||||
xmlTextWriterWriteDTDInternalEntity
|
||||
xmlTextWriterWriteDTDNotation
|
||||
xmlTextWriterWriteElement
|
||||
xmlTextWriterWriteElementNS
|
||||
xmlTextWriterWriteFormatAttribute
|
||||
xmlTextWriterWriteFormatAttributeNS
|
||||
xmlTextWriterWriteFormatCDATA
|
||||
xmlTextWriterWriteFormatComment
|
||||
xmlTextWriterWriteFormatDTD
|
||||
xmlTextWriterWriteFormatDTDAttlist
|
||||
xmlTextWriterWriteFormatDTDElement
|
||||
xmlTextWriterWriteFormatDTDInternalEntity
|
||||
xmlTextWriterWriteFormatElement
|
||||
xmlTextWriterWriteFormatElementNS
|
||||
xmlTextWriterWriteFormatPI
|
||||
xmlTextWriterWriteFormatRaw
|
||||
xmlTextWriterWriteFormatString
|
||||
xmlTextWriterWritePI
|
||||
xmlTextWriterWriteRaw
|
||||
xmlTextWriterWriteRawLen
|
||||
xmlTextWriterWriteString
|
||||
xmlTextWriterWriteVFormatAttribute
|
||||
xmlTextWriterWriteVFormatAttributeNS
|
||||
xmlTextWriterWriteVFormatCDATA
|
||||
xmlTextWriterWriteVFormatComment
|
||||
xmlTextWriterWriteVFormatDTD
|
||||
xmlTextWriterWriteVFormatDTDAttlist
|
||||
xmlTextWriterWriteVFormatDTDElement
|
||||
xmlTextWriterWriteVFormatDTDInternalEntity
|
||||
xmlTextWriterWriteVFormatElement
|
||||
xmlTextWriterWriteVFormatElementNS
|
||||
xmlTextWriterWriteVFormatPI
|
||||
xmlTextWriterWriteVFormatRaw
|
||||
xmlTextWriterWriteVFormatString
|
||||
xmlThrDefBufferAllocScheme
|
||||
xmlThrDefDefaultBufferSize
|
||||
xmlThrDefDeregisterNodeDefault
|
||||
@@ -877,8 +1107,10 @@ xmlThrDefPedanticParserDefaultValue
|
||||
xmlThrDefRegisterNodeDefault
|
||||
xmlThrDefSaveNoEmptyTags
|
||||
xmlThrDefSetGenericErrorFunc
|
||||
xmlThrDefSetStructuredErrorFunc
|
||||
xmlThrDefSubstituteEntitiesDefaultValue
|
||||
xmlThrDefTreeIndentString
|
||||
xmlUCSIsAegeanNumbers
|
||||
xmlUCSIsAlphabeticPresentationForms
|
||||
xmlUCSIsArabic
|
||||
xmlUCSIsArabicPresentationFormsA
|
||||
@@ -893,6 +1125,7 @@ xmlUCSIsBopomofo
|
||||
xmlUCSIsBopomofoExtended
|
||||
xmlUCSIsBoxDrawing
|
||||
xmlUCSIsBraillePatterns
|
||||
xmlUCSIsBuhid
|
||||
xmlUCSIsByzantineMusicalSymbols
|
||||
xmlUCSIsCJKCompatibility
|
||||
xmlUCSIsCJKCompatibilityForms
|
||||
@@ -942,11 +1175,14 @@ xmlUCSIsCatZp
|
||||
xmlUCSIsCatZs
|
||||
xmlUCSIsCherokee
|
||||
xmlUCSIsCombiningDiacriticalMarks
|
||||
xmlUCSIsCombiningDiacriticalMarksforSymbols
|
||||
xmlUCSIsCombiningHalfMarks
|
||||
xmlUCSIsCombiningMarksforSymbols
|
||||
xmlUCSIsControlPictures
|
||||
xmlUCSIsCurrencySymbols
|
||||
xmlUCSIsCypriotSyllabary
|
||||
xmlUCSIsCyrillic
|
||||
xmlUCSIsCyrillicSupplement
|
||||
xmlUCSIsDeseret
|
||||
xmlUCSIsDevanagari
|
||||
xmlUCSIsDingbats
|
||||
@@ -959,12 +1195,14 @@ xmlUCSIsGeorgian
|
||||
xmlUCSIsGothic
|
||||
xmlUCSIsGreek
|
||||
xmlUCSIsGreekExtended
|
||||
xmlUCSIsGreekandCoptic
|
||||
xmlUCSIsGujarati
|
||||
xmlUCSIsGurmukhi
|
||||
xmlUCSIsHalfwidthandFullwidthForms
|
||||
xmlUCSIsHangulCompatibilityJamo
|
||||
xmlUCSIsHangulJamo
|
||||
xmlUCSIsHangulSyllables
|
||||
xmlUCSIsHanunoo
|
||||
xmlUCSIsHebrew
|
||||
xmlUCSIsHighPrivateUseSurrogates
|
||||
xmlUCSIsHighSurrogates
|
||||
@@ -975,18 +1213,26 @@ xmlUCSIsKanbun
|
||||
xmlUCSIsKangxiRadicals
|
||||
xmlUCSIsKannada
|
||||
xmlUCSIsKatakana
|
||||
xmlUCSIsKatakanaPhoneticExtensions
|
||||
xmlUCSIsKhmer
|
||||
xmlUCSIsKhmerSymbols
|
||||
xmlUCSIsLao
|
||||
xmlUCSIsLatin1Supplement
|
||||
xmlUCSIsLatinExtendedA
|
||||
xmlUCSIsLatinExtendedAdditional
|
||||
xmlUCSIsLatinExtendedB
|
||||
xmlUCSIsLetterlikeSymbols
|
||||
xmlUCSIsLimbu
|
||||
xmlUCSIsLinearBIdeograms
|
||||
xmlUCSIsLinearBSyllabary
|
||||
xmlUCSIsLowSurrogates
|
||||
xmlUCSIsMalayalam
|
||||
xmlUCSIsMathematicalAlphanumericSymbols
|
||||
xmlUCSIsMathematicalOperators
|
||||
xmlUCSIsMiscellaneousMathematicalSymbolsA
|
||||
xmlUCSIsMiscellaneousMathematicalSymbolsB
|
||||
xmlUCSIsMiscellaneousSymbols
|
||||
xmlUCSIsMiscellaneousSymbolsandArrows
|
||||
xmlUCSIsMiscellaneousTechnical
|
||||
xmlUCSIsMongolian
|
||||
xmlUCSIsMusicalSymbols
|
||||
@@ -996,23 +1242,40 @@ xmlUCSIsOgham
|
||||
xmlUCSIsOldItalic
|
||||
xmlUCSIsOpticalCharacterRecognition
|
||||
xmlUCSIsOriya
|
||||
xmlUCSIsOsmanya
|
||||
xmlUCSIsPhoneticExtensions
|
||||
xmlUCSIsPrivateUse
|
||||
xmlUCSIsPrivateUseArea
|
||||
xmlUCSIsRunic
|
||||
xmlUCSIsShavian
|
||||
xmlUCSIsSinhala
|
||||
xmlUCSIsSmallFormVariants
|
||||
xmlUCSIsSpacingModifierLetters
|
||||
xmlUCSIsSpecials
|
||||
xmlUCSIsSuperscriptsandSubscripts
|
||||
xmlUCSIsSupplementalArrowsA
|
||||
xmlUCSIsSupplementalArrowsB
|
||||
xmlUCSIsSupplementalMathematicalOperators
|
||||
xmlUCSIsSupplementaryPrivateUseAreaA
|
||||
xmlUCSIsSupplementaryPrivateUseAreaB
|
||||
xmlUCSIsSyriac
|
||||
xmlUCSIsTagalog
|
||||
xmlUCSIsTagbanwa
|
||||
xmlUCSIsTags
|
||||
xmlUCSIsTaiLe
|
||||
xmlUCSIsTaiXuanJingSymbols
|
||||
xmlUCSIsTamil
|
||||
xmlUCSIsTelugu
|
||||
xmlUCSIsThaana
|
||||
xmlUCSIsThai
|
||||
xmlUCSIsTibetan
|
||||
xmlUCSIsUgaritic
|
||||
xmlUCSIsUnifiedCanadianAboriginalSyllabics
|
||||
xmlUCSIsVariationSelectors
|
||||
xmlUCSIsVariationSelectorsSupplement
|
||||
xmlUCSIsYiRadicals
|
||||
xmlUCSIsYiSyllables
|
||||
xmlUCSIsYijingHexagramSymbols
|
||||
xmlURIEscape
|
||||
xmlURIEscapeStr
|
||||
xmlURIUnescapeString
|
||||
@@ -1058,8 +1321,14 @@ xmlValidatePushCData
|
||||
xmlValidatePushElement
|
||||
xmlValidateQName
|
||||
xmlValidateRoot
|
||||
xmlXIncludeFreeContext
|
||||
xmlXIncludeNewContext
|
||||
xmlXIncludeProcess
|
||||
xmlXIncludeProcessFlags
|
||||
xmlXIncludeProcessNode
|
||||
xmlXIncludeProcessTree
|
||||
xmlXIncludeProcessTreeFlags
|
||||
xmlXIncludeSetFlags
|
||||
xmlXPathAddValues
|
||||
xmlXPathBooleanFunction
|
||||
xmlXPathCastBooleanToNumber
|
||||
@@ -1078,6 +1347,7 @@ xmlXPathCastToNumber
|
||||
xmlXPathCastToString
|
||||
xmlXPathCeilingFunction
|
||||
xmlXPathCmpNodes
|
||||
xmlXPathCtxtCompile
|
||||
xmlXPathCompareValues
|
||||
xmlXPathCompile
|
||||
xmlXPathCompiledEval
|
||||
@@ -1087,6 +1357,7 @@ xmlXPathConvertBoolean
|
||||
xmlXPathConvertNumber
|
||||
xmlXPathConvertString
|
||||
xmlXPathCountFunction
|
||||
xmlXPathCtxtCompile
|
||||
xmlXPathDebugDumpCompExpr
|
||||
xmlXPathDebugDumpObject
|
||||
xmlXPathDifference
|
||||
@@ -1094,6 +1365,7 @@ xmlXPathDistinct
|
||||
xmlXPathDistinctSorted
|
||||
xmlXPathDivValues
|
||||
xmlXPathEqualValues
|
||||
xmlXPathErr
|
||||
xmlXPathEval
|
||||
xmlXPathEvalExpr
|
||||
xmlXPathEvalExpression
|
||||
@@ -1208,6 +1480,7 @@ xmlXPathWrapCString
|
||||
xmlXPathWrapExternal
|
||||
xmlXPathWrapNodeSet
|
||||
xmlXPathWrapString
|
||||
xmlXPathErr
|
||||
xmlXPatherror
|
||||
xmlXPtrBuildNodeList
|
||||
xmlXPtrEval
|
||||
@@ -1230,9 +1503,69 @@ xmlXPtrNewRangePointNode
|
||||
xmlXPtrNewRangePoints
|
||||
xmlXPtrRangeToFunction
|
||||
xmlXPtrWrapLocationSet
|
||||
_libiconv_version
|
||||
libiconv_close
|
||||
libiconv
|
||||
libiconv_open
|
||||
libiconv_set_relocation_prefix
|
||||
| ||||