mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-14 04:30:50 +00:00
Compare commits
228
Commits
php-5.4.19
...
php-5.4.22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd4301120f | ||
|
|
41f6096ab2 | ||
|
|
0d89265a69 | ||
|
|
16a9fec889 | ||
|
|
4dc4302a30 | ||
|
|
e2c9f3983a | ||
|
|
69808d698c | ||
|
|
ab6481993e | ||
|
|
7a526f01b5 | ||
|
|
e50eb1ce34 | ||
|
|
9cb3a759a7 | ||
|
|
1f5b1cfb2b | ||
|
|
2cf5614f5f | ||
|
|
5cc797d119 | ||
|
|
2fa5f39e4c | ||
|
|
1b43f95040 | ||
|
|
2ecf94e07e | ||
|
|
f860486de5 | ||
|
|
297324146e | ||
|
|
27ebcb8d0e | ||
|
|
2186e1583d | ||
|
|
18cc5386de | ||
|
|
8f4a6d6e1b | ||
|
|
1494298231 | ||
|
|
9976b5cd7f | ||
|
|
52555a7894 | ||
|
|
b6feabc8c6 | ||
|
|
33d377e701 | ||
|
|
fb38fdc7fd | ||
|
|
a1daebefda | ||
|
|
420068c6e1 | ||
|
|
85a622e42f | ||
|
|
aa4f9b322b | ||
|
|
2be67ca457 | ||
|
|
813e867652 | ||
|
|
a55d3b9295 | ||
|
|
df501fd464 | ||
|
|
6919d15a2e | ||
|
|
1fe1f7305b | ||
|
|
4c0bb6d76e | ||
|
|
b0a36007ab | ||
|
|
9ccde8a415 | ||
|
|
7a038ccbe6 | ||
|
|
960b4e81f3 | ||
|
|
9fbfdb3396 | ||
|
|
22700890d4 | ||
|
|
b026993a74 | ||
|
|
b5a0f12871 | ||
|
|
63f242178d | ||
|
|
d74b9cfee5 | ||
|
|
690bbe170d | ||
|
|
3aaee86ee3 | ||
|
|
248afd1c3c | ||
|
|
6a823071f9 | ||
|
|
96cc419924 | ||
|
|
8973390541 | ||
|
|
e8ae795529 | ||
|
|
76d2d474be | ||
|
|
f6ff3a28d6 | ||
|
|
545363cce0 | ||
|
|
dc3d360a0f | ||
|
|
fc3f8a8f54 | ||
|
|
9209c19f8f | ||
|
|
dbe2d7745f | ||
|
|
b2f8f35a88 | ||
|
|
33fd0e0b78 | ||
|
|
cd1cab3f47 | ||
|
|
930946005e | ||
|
|
18b04b480e | ||
|
|
679bf479b6 | ||
|
|
2b78edfba2 | ||
|
|
e9e63f9223 | ||
|
|
f0c926564c | ||
|
|
d143c2b60f | ||
|
|
7e35004e39 | ||
|
|
0ad0a2f56e | ||
|
|
7a1a1aec8c | ||
|
|
ac05cfb499 | ||
|
|
9aa904c375 | ||
|
|
b4b4372c88 | ||
|
|
30e0442c54 | ||
|
|
34fc79bd61 | ||
|
|
cc66eaa04b | ||
|
|
d5ba2d8a99 | ||
|
|
7a24ee13ec | ||
|
|
7e9044b6a2 | ||
|
|
9bfd55cda3 | ||
|
|
dfd7d1063a | ||
|
|
7c279df6ae | ||
|
|
6a0b90da84 | ||
|
|
1939d9e3db | ||
|
|
18b54a2366 | ||
|
|
8a936e8eb9 | ||
|
|
c0afe829e3 | ||
|
|
a475b2c1db | ||
|
|
7bb8cbcdee | ||
|
|
160cd8d0a7 | ||
|
|
3c3b2b5bdc | ||
|
|
7beef74a82 | ||
|
|
6c48c6bc78 | ||
|
|
ed038d2ee3 | ||
|
|
bfb1fe10cb | ||
|
|
d69513afec | ||
|
|
7da6498342 | ||
|
|
5bff1286b6 | ||
|
|
dfc6feb6e8 | ||
|
|
15694f66b2 | ||
|
|
747daa5354 | ||
|
|
72027cd084 | ||
|
|
1fdcc705a4 | ||
|
|
3745bdadc0 | ||
|
|
e6424d89e9 | ||
|
|
b378b0b081 | ||
|
|
e22c139fe0 | ||
|
|
6b8dade6dc | ||
|
|
3f9af558e7 | ||
|
|
768c34e7cd | ||
|
|
5ab6d215fc | ||
|
|
7109f369e8 | ||
|
|
f2ceb4963e | ||
|
|
d5987478a8 | ||
|
|
54d4a28003 | ||
|
|
1af111dd68 | ||
|
|
d0bede2efa | ||
|
|
f38bd22ed2 | ||
|
|
d8023d13eb | ||
|
|
540f325664 | ||
|
|
696852f2bd | ||
|
|
5c06e5c2e0 | ||
|
|
e9b12bedc3 | ||
|
|
9c9fee3f43 | ||
|
|
d82f9339fe | ||
|
|
eba85f91d8 | ||
|
|
b455ba971c | ||
|
|
27c803aaed | ||
|
|
72d1ec883e | ||
|
|
9789df7764 | ||
|
|
d487f5e9ac | ||
|
|
dc384a571d | ||
|
|
c60067c09a | ||
|
|
1ac4d8f2c6 | ||
|
|
aa7d3d8e6d | ||
|
|
a4862503d4 | ||
|
|
71c24f4c2e | ||
|
|
4bad49e3bc | ||
|
|
cf96aa155e | ||
|
|
c1c49d6e39 | ||
|
|
14f5732096 | ||
|
|
9973658a44 | ||
|
|
0154db1c5f | ||
|
|
98d29d20a1 | ||
|
|
a3fa25e857 | ||
|
|
3da2fb335d | ||
|
|
ac2d2b9b72 | ||
|
|
4a0e87e497 | ||
|
|
cb539b3e96 | ||
|
|
6993ca5bd7 | ||
|
|
0ebef462ce | ||
|
|
060fadca31 | ||
|
|
ba30c78d5c | ||
|
|
8280393828 | ||
|
|
9ad97cd489 | ||
|
|
9d62807190 | ||
|
|
7f69f07fc1 | ||
|
|
dcea4ec698 | ||
|
|
2874696a5a | ||
|
|
f4dc2240a0 | ||
|
|
72aacbf735 | ||
|
|
4134ebec8e | ||
|
|
cf39c3d638 | ||
|
|
36b759d1dd | ||
|
|
503d39d925 | ||
|
|
bff1a96a0f | ||
|
|
0ad81ac18a | ||
|
|
e9b128c1bf | ||
|
|
ac28283beb | ||
|
|
fc7fe62e3b | ||
|
|
a188693a27 | ||
|
|
80fe5461a9 | ||
|
|
4ed133c4e2 | ||
|
|
2743c3aac8 | ||
|
|
a831499b4a | ||
|
|
47d66a0b4e | ||
|
|
3bbe5931bc | ||
|
|
a5c524f1be | ||
|
|
3c5e229212 | ||
|
|
ec4019e8f6 | ||
|
|
cabf38af6d | ||
|
|
f718684a6c | ||
|
|
a93a462dce | ||
|
|
8d86597d73 | ||
|
|
5f137d080a | ||
|
|
a03f0943ca | ||
|
|
d60e168a7a | ||
|
|
ea75b1b5db | ||
|
|
e55f08a5ae | ||
|
|
5753b74fab | ||
|
|
ce9169e360 | ||
|
|
cb13f8318b | ||
|
|
4590070f31 | ||
|
|
4395f70207 | ||
|
|
fd8f454520 | ||
|
|
0a974f14d1 | ||
|
|
1d7b6970f2 | ||
|
|
fd616ba50f | ||
|
|
29b2522df1 | ||
|
|
979194351d | ||
|
|
515092917d | ||
|
|
9909c4d4c4 | ||
|
|
96a53f6715 | ||
|
|
c28ab73d73 | ||
|
|
9b6aa268a3 | ||
|
|
a1bf38e075 | ||
|
|
7c9bb87edd | ||
|
|
25f924abf6 | ||
|
|
f8efdc2b4b | ||
|
|
1b4103c09d | ||
|
|
ba984582db | ||
|
|
da3886de6d | ||
|
|
3380de9774 | ||
|
|
cc91fbe986 | ||
|
|
b963249456 | ||
|
|
a015fa83a7 | ||
|
|
2b9d42433f | ||
|
|
445dffa75a | ||
|
|
b9e3f737d9 | ||
|
|
e6ae977082 | ||
|
|
ba3234888d |
No files matched your search
+1
-1
@@ -151,7 +151,7 @@ Naming Conventions
|
||||
|
||||
7. Classes should be given descriptive names. Avoid using abbreviations where
|
||||
possible. Each word in the class name should start with a capital letter,
|
||||
without underscore delimiters (CampelCaps starting with a capital letter).
|
||||
without underscore delimiters (CamelCaps starting with a capital letter).
|
||||
The class name should be prefixed with the name of the 'parent set' (e.g.
|
||||
the name of the extension)::
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ all: $(all_targets)
|
||||
@echo "Build complete."
|
||||
@echo "Don't forget to run 'make test'."
|
||||
@echo
|
||||
|
||||
|
||||
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
|
||||
|
||||
build-binaries: $(PHP_BINARIES)
|
||||
@@ -116,7 +116,7 @@ clean:
|
||||
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
|
||||
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak
|
||||
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
||||
|
||||
.PHONY: all clean install distclean test
|
||||
|
||||
@@ -1,8 +1,164 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2013, PHP 5.4.18
|
||||
14 Nov 2013, PHP 5.4.22
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65911 (scope resolution operator - strange behavior with $this).
|
||||
(Bob Weinand)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #65818 (Segfault with built-in webserver and chunked transfer
|
||||
encoding). (Felipe)
|
||||
|
||||
- Exif:
|
||||
. Fixed crash on unknown encoding. (Draal)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #65667 (ftp_nb_continue produces segfault). (Philip Hofstetter)
|
||||
|
||||
- ODBC
|
||||
. Fixed bug #65950 (Field name truncation if the field name is bigger than
|
||||
32 characters). (patch submitted by: michael dot y at zend dot com, Yasuo)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
|
||||
(Mike)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #64760 (var_export() does not use full precision for floating-point
|
||||
numbers) (Yasuo)
|
||||
|
||||
- XMLReader:
|
||||
. Fixed bug #51936 (Crash with clone XMLReader). (Mike)
|
||||
. Fixed bug #64230 (XMLReader does not suppress errors). (Mike)
|
||||
|
||||
|
||||
17 Oct 2013, PHP 5.4.21
|
||||
|
||||
- Core:
|
||||
. Fixed bug #65322 (compile time errors won't trigger auto loading). (Nikita)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #65633 (built-in server treat some http headers as
|
||||
case-sensitive). (Adam)
|
||||
|
||||
- Datetime:
|
||||
. Fixed bug #64157 (DateTime::createFromFormat() reports confusing error
|
||||
message). (Boro Sitnikovski)
|
||||
|
||||
- DBA extension:
|
||||
. Fixed bug #65708 (dba functions cast $key param to string in-place,
|
||||
bypassing copy on write). (Adam)
|
||||
|
||||
- Filter:
|
||||
. Add RFC 6598 IPs to reserved addresses. (Sebastian Nohn)
|
||||
. Fixed bug #64441 (FILTER_VALIDATE_URL rejects fully qualified domain names).
|
||||
(Syra)
|
||||
|
||||
- IMAP:
|
||||
. Fixed bug #65721 (configure script broken in 5.5.4 and 5.4.20 when enabling
|
||||
imap). (ryotakatsuki at gmail dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #61548 (content-type must appear at the end of headers for 201
|
||||
Location to work in http). (Mike)
|
||||
|
||||
- Build system:
|
||||
. Fixed bug #62396 ('make test' crashes starting with 5.3.14 (missing
|
||||
gzencode())). (Mike)
|
||||
|
||||
|
||||
19 Sep 2013, PHP 5.4.20
|
||||
|
||||
- Core:
|
||||
. Fixed bug #60598 (cli/apache sapi segfault on objects manipulation).
|
||||
(Laruence)
|
||||
. Fixed bug #65579 (Using traits with get_class_methods causes segfault).
|
||||
(Adam)
|
||||
. Fixed bug #65490 (Duplicate calls to get lineno & filename for
|
||||
DTRACE_FUNCTION_*). (Chris Jones)
|
||||
. Fixed bug #65483 (quoted-printable encode stream filter incorrectly encoding
|
||||
spaces). (Michael M Slusarz)
|
||||
. Fixed bug #65481 (shutdown segfault due to serialize) (Mike)
|
||||
. Fixed bug #65470 (Segmentation fault in zend_error() with
|
||||
--enable-dtrace). (Chris Jones, Kris Van Hees)
|
||||
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
|
||||
fails). (Laruence)
|
||||
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
|
||||
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
|
||||
limited case). (Arpad)
|
||||
. Fixed bug #65225 (PHP_BINARY incorrectly set). (Patrick Allaert)
|
||||
. Improved fix for bug #63186 (compile failure on netbsd). (Matteo)
|
||||
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
|
||||
. Fixed bug #61759 (class_alias() should accept classes with leading
|
||||
backslashes). (Julien)
|
||||
. Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
|
||||
. Cherry-picked some DTrace build commits (allowing builds on Linux,
|
||||
bug #62691, and bug #63706) from PHP 5.5 branch
|
||||
. Fixed bug #61268 (--enable-dtrace leads make to clobber
|
||||
Zend/zend_dtrace.d) (Chris Jones)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #65458 (curl memory leak). (Adam)
|
||||
|
||||
- Datetime:
|
||||
. Fixed bug #65554 (createFromFormat broken when weekday name is followed
|
||||
by some delimiters). (Valentin Logvinskiy, Stas).
|
||||
. Fixed bug #65564 (stack-buffer-overflow in DateTimeZone stuff caught
|
||||
by AddressSanitizer). (Remi).
|
||||
|
||||
- Openssl:
|
||||
. Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
|
||||
some cases). (Mark Jones)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
|
||||
gmail dot com)
|
||||
. Fixed bug #50308 (session id not appended properly for empty anchor tags).
|
||||
(Arpad)
|
||||
. Fixed possible buffer overflow under Windows. Note: Not a security fix.
|
||||
(Yasuo)
|
||||
. Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #65328 (Segfault when getting SplStack object Value). (Laruence)
|
||||
|
||||
- PDO:
|
||||
. Fixed bug #64953 (Postgres prepared statement positional parameter
|
||||
casting). (Mike)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
|
||||
some specific contents). (Stas)
|
||||
|
||||
- Pgsql:
|
||||
. Fixed bug #65336 (pg_escape_literal/identifier() silently returns false).
|
||||
(Yasuo)
|
||||
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
|
||||
/pg_delete()/pg_insert()). (Yasuo)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #65391 (Unable to send vary header user-agent when
|
||||
ob_start('ob_gzhandler') is called) (Mike)
|
||||
|
||||
22 Aug 2013, PHP 5.4.19
|
||||
|
||||
- Core:
|
||||
. Fixed bug #64503 (Compilation fails with error: conflicting types for
|
||||
'zendparse'). (Laruence)
|
||||
|
||||
- Openssl:
|
||||
. Fixed UMR in fix for CVE-2013-4248.
|
||||
|
||||
15 Aug 2013, PHP 5.4.18
|
||||
|
||||
- Core:
|
||||
. Fixed value of FILTER_SANITIZE_FULL_SPECIAL_CHARS constant (previously was
|
||||
erroneously set to FILTER_SANITIZE_SPECIAL_CHARS value). (Andrey
|
||||
avp200681 gmail com).
|
||||
. Fixed bug #65254 (Exception not catchable when exception thrown in autoload
|
||||
with a namespace). (Laruence)
|
||||
. Fixed bug #65108 (is_callable() triggers Fatal Error).
|
||||
@@ -54,6 +210,10 @@ PHP NEWS
|
||||
. Fixed bug #61387 (NULL valued anonymous column causes segfault in
|
||||
odbc_fetch_array). (Brandon Kirsch)
|
||||
|
||||
- Openssl:
|
||||
. Fixed handling null bytes in subjectAltName (CVE-2013-4248).
|
||||
(Christian Heimes)
|
||||
|
||||
- PDO:
|
||||
. Allowed PDO_OCI to compile with Oracle Database 12c client libraries.
|
||||
(Chris Jones)
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ zend_module_entry foo_module_entry = {
|
||||
PHP_RSHUTDOWN(foo), /* per-request shutdown function */
|
||||
PHP_MINFO(foo), /* information function */
|
||||
#if ZEND_MODULE_API_NO >= 20010901
|
||||
FOO_VERSION, /* extension version number (string) */
|
||||
PHP_FOO_VERSION, /* extension version number (string) */
|
||||
#endif
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -31,6 +31,11 @@ HOW TO USE IT
|
||||
|
||||
./buildconf; ./configure --enable-module_name; make
|
||||
|
||||
The definition of PHP_MODULE_NAME_VERSION will be present in the
|
||||
php_module_name.h and injected into the zend_module_entry definition. This
|
||||
is required by the PECL website for the version string conformity checks
|
||||
against package.xml
|
||||
|
||||
But if you already have planned the overall scheme of your module, what
|
||||
functions it will contain, their return types and the arguments they take
|
||||
(a very good idea) and don't want to bother yourself with creating function
|
||||
|
||||
@@ -153,3 +153,18 @@ ADDING SHARED MODULE SUPPORT TO A MODULE
|
||||
#ifdef COMPILE_DL_FOO
|
||||
ZEND_GET_MODULE(foo)
|
||||
#endif
|
||||
|
||||
PECL SITE CONFORMITY
|
||||
|
||||
If you plan to release an extension to the PECL website, there are several
|
||||
points to be regarded.
|
||||
|
||||
1. Add LICENSE or COPYING to the package.xml
|
||||
|
||||
2. The following should be defined in one of the extension header files
|
||||
|
||||
#define PHP_FOO_VERSION "1.2.3"
|
||||
|
||||
This macros has to be used within your foo_module_entry to indicate the
|
||||
extension version.
|
||||
|
||||
+5
-3
@@ -625,7 +625,7 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
shm->info = info_handle;
|
||||
shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL);
|
||||
|
||||
if (created) {
|
||||
if (NULL != shm->descriptor && created) {
|
||||
shm->descriptor->shm_perm.key = key;
|
||||
shm->descriptor->shm_segsz = size;
|
||||
shm->descriptor->shm_ctime = time(NULL);
|
||||
@@ -639,8 +639,10 @@ TSRM_API int shmget(int key, int size, int flags)
|
||||
shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0;
|
||||
}
|
||||
|
||||
if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) {
|
||||
CloseHandle(shm->segment);
|
||||
if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) {
|
||||
if (NULL != shm->segment) {
|
||||
CloseHandle(shm->segment);
|
||||
}
|
||||
UnmapViewOfFile(shm->descriptor);
|
||||
CloseHandle(shm->info);
|
||||
return -1;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
bison_version=none
|
||||
if test "$YACC"; then
|
||||
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
|
||||
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
|
||||
bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z`
|
||||
php_cv_bison_version=invalid
|
||||
if test -n "$bison_version_vars"; then
|
||||
set $bison_version_vars
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #60598 (cli/apache sapi segfault on objects manipulation)
|
||||
--FILE--
|
||||
<?php
|
||||
define('OBJECT_COUNT', 10000);
|
||||
|
||||
$containers = array();
|
||||
|
||||
class Object {
|
||||
protected $_guid = 0;
|
||||
public function __construct() {
|
||||
global $containers;
|
||||
$this->guid = 1;
|
||||
$containers[spl_object_hash($this)] = $this;
|
||||
}
|
||||
public function __destruct() {
|
||||
global $containers;
|
||||
$containers[spl_object_hash($this)] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < OBJECT_COUNT; ++$i) {
|
||||
new Object();
|
||||
}
|
||||
|
||||
// You probably won't see this because of the "zend_mm_heap corrupted"
|
||||
?>
|
||||
If you see this, try to increase OBJECT_COUNT to 100,000
|
||||
--EXPECT--
|
||||
If you see this, try to increase OBJECT_COUNT to 100,000
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
--TEST--
|
||||
test of larger than 8kb text file being parsed by require statement
|
||||
--FILE--
|
||||
<?php
|
||||
file_put_contents('test.php',str_repeat('passed, ',1024));
|
||||
require('test.php');
|
||||
unlink('test.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,Line truncated
|
||||
--TEST--
|
||||
test of larger than 8kb text file being parsed by require statement
|
||||
--FILE--
|
||||
<?php
|
||||
file_put_contents('test.php',str_repeat('passed, ',1024));
|
||||
require('./test.php');
|
||||
unlink('test.php');
|
||||
?>
|
||||
--EXPECT--
|
||||
passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed,Line truncated
|
||||
@@ -0,0 +1,47 @@
|
||||
--TEST--
|
||||
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
|
||||
--XFAIL--
|
||||
We can not fix this bug without a significant (performace slow down) change to gc
|
||||
--FILE--
|
||||
<?php
|
||||
$bar = NULL;
|
||||
class bad
|
||||
{
|
||||
private $_private = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_private[] = 'php';
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
global $bar;
|
||||
$bar = $this;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new stdclass;
|
||||
$foo->foo = $foo;
|
||||
$foo->bad = new bad;
|
||||
|
||||
gc_disable();
|
||||
|
||||
unserialize(serialize($foo));
|
||||
gc_collect_cycles();
|
||||
var_dump($bar);
|
||||
/* will output:
|
||||
object(bad)#4 (1) {
|
||||
["_private":"bad":private]=>
|
||||
&UNKNOWN:0
|
||||
}
|
||||
*/
|
||||
?>
|
||||
--EXPECTF--
|
||||
bject(bad)#%d (1) {
|
||||
["_private":"bad":private]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(3) "php"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait
|
||||
{
|
||||
public static function testStaticFunction()
|
||||
{
|
||||
return __CLASS__;
|
||||
}
|
||||
}
|
||||
class Tester
|
||||
{
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
$foo = Tester::testStaticFunction();
|
||||
get_defined_constants();
|
||||
get_defined_constants(true);
|
||||
|
||||
echo $foo;
|
||||
?>
|
||||
--EXPECT--
|
||||
Tester
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #65322: compile time errors won't trigger auto loading
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($class) {
|
||||
var_dump($class);
|
||||
class B {}
|
||||
});
|
||||
|
||||
set_error_handler(function($_, $msg, $file) {
|
||||
var_dump($msg, $file);
|
||||
new B;
|
||||
});
|
||||
|
||||
eval('class A { function a() {} function __construct() {} }');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(50) "Redefining already defined constructor for class A"
|
||||
string(%d) "%s(%d) : eval()'d code"
|
||||
string(1) "B"
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #65372 (Segfault in gc_zval_possible_root when return reference fails)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class ParentClass
|
||||
{
|
||||
private static $_OBJECTS;
|
||||
|
||||
public static function Get()
|
||||
{
|
||||
self::$_OBJECTS[1] = new ChildClass();
|
||||
return self::$_OBJECTS[1];
|
||||
}
|
||||
}
|
||||
|
||||
class ChildClass extends ParentClass
|
||||
{
|
||||
public $Manager;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->Manager = $this;
|
||||
}
|
||||
|
||||
public static function &GetCurrent()
|
||||
{
|
||||
return ChildClass::Get();
|
||||
}
|
||||
|
||||
public static function &Get()
|
||||
{
|
||||
return parent::Get();
|
||||
}
|
||||
}
|
||||
|
||||
$staff = ChildClass::GetCurrent();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Only variable references should be returned by reference in %sbug65372.php on line 30
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #65579 (Using traits with get_class_methods causes segfault)
|
||||
--FILE--
|
||||
<?php
|
||||
trait ParentTrait {
|
||||
public function testMethod() { }
|
||||
}
|
||||
|
||||
trait ChildTrait {
|
||||
use ParentTrait {
|
||||
testMethod as testMethodFromParentTrait;
|
||||
}
|
||||
public function testMethod() { }
|
||||
}
|
||||
|
||||
class TestClass {
|
||||
use ChildTrait;
|
||||
}
|
||||
|
||||
$obj = new TestClass();
|
||||
var_dump(get_class_methods($obj));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(10) "testMethod"
|
||||
[1]=>
|
||||
string(25) "testmethodfromparenttrait"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #65911 (scope resolution operator - strange behavior with $this)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {}
|
||||
|
||||
class B
|
||||
{
|
||||
public function go()
|
||||
{
|
||||
$this->foo = 'bar';
|
||||
echo A::$this->foo; // should not output 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new B();
|
||||
$obj->go();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Access to undeclared static property: A::$this in %s on line %d
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Error message in error handler during compilation
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function($_, $msg, $file) {
|
||||
var_dump($msg, $file);
|
||||
echo $undefined;
|
||||
});
|
||||
|
||||
eval('class A { function a() {} function __construct() {} }');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(50) "Redefining already defined constructor for class A"
|
||||
string(%d) "%s(%d) : eval()'d code"
|
||||
|
||||
Notice: Undefined variable: undefined in %s on line %d
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Overridding Conflicting Methods should not result in a notice/warning about collisions
|
||||
Overriding Conflicting Methods should not result in a notice/warning about collisions
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
+8
-4
@@ -1091,17 +1091,19 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
error_filename = "Unknown";
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
#ifdef HAVE_DTRACE
|
||||
if(DTRACE_ERROR_ENABLED()) {
|
||||
char *dtrace_error_buffer;
|
||||
va_start(args, format);
|
||||
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
|
||||
DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
|
||||
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
|
||||
efree(dtrace_error_buffer);
|
||||
va_end(args);
|
||||
}
|
||||
#endif /* HAVE_DTRACE */
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
/* if we don't have a user defined error handler */
|
||||
if (!EG(user_error_handler)
|
||||
|| !(EG(user_error_handler_error_reporting) & type)
|
||||
@@ -1181,7 +1183,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
* such scripts recursivly, but some CG() variables may be
|
||||
* inconsistent. */
|
||||
|
||||
in_compilation = zend_is_compiling(TSRMLS_C);
|
||||
in_compilation = CG(in_compilation);
|
||||
if (in_compilation) {
|
||||
saved_class_entry = CG(active_class_entry);
|
||||
CG(active_class_entry) = NULL;
|
||||
@@ -1193,6 +1195,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
SAVE_STACK(declare_stack);
|
||||
SAVE_STACK(list_stack);
|
||||
SAVE_STACK(context_stack);
|
||||
CG(in_compilation) = 0;
|
||||
}
|
||||
|
||||
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
|
||||
@@ -1217,6 +1220,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
|
||||
RESTORE_STACK(declare_stack);
|
||||
RESTORE_STACK(list_stack);
|
||||
RESTORE_STACK(context_stack);
|
||||
CG(in_compilation) = 1;
|
||||
}
|
||||
|
||||
if (!EG(user_error_handler)) {
|
||||
|
||||
+15
-9
@@ -2514,7 +2514,12 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c
|
||||
char *lcname = zend_str_tolower_dup(name, name_len);
|
||||
int ret;
|
||||
|
||||
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
|
||||
if (lcname[0] == '\\') {
|
||||
ret = zend_hash_add(CG(class_table), lcname+1, name_len, &ce, sizeof(zend_class_entry *), NULL);
|
||||
} else {
|
||||
ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, sizeof(zend_class_entry *), NULL);
|
||||
}
|
||||
|
||||
efree(lcname);
|
||||
if (ret == SUCCESS) {
|
||||
ce->refcount++;
|
||||
@@ -3917,15 +3922,16 @@ ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name
|
||||
{
|
||||
zend_trait_alias *alias, **alias_ptr;
|
||||
|
||||
alias_ptr = ce->trait_aliases;
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (alias->alias_len == len &&
|
||||
!strncasecmp(name, alias->alias, alias->alias_len)) {
|
||||
return alias->alias;
|
||||
}
|
||||
alias_ptr++;
|
||||
if ((alias_ptr = ce->trait_aliases)) {
|
||||
alias = *alias_ptr;
|
||||
while (alias) {
|
||||
if (alias->alias_len == len &&
|
||||
!strncasecmp(name, alias->alias, alias->alias_len)) {
|
||||
return alias->alias;
|
||||
}
|
||||
alias_ptr++;
|
||||
alias = *alias_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
|
||||
@@ -1399,15 +1399,8 @@ ZEND_FUNCTION(class_alias)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoload) {
|
||||
lc_name = do_alloca(class_name_len + 1, use_heap);
|
||||
zend_str_tolower_copy(lc_name, class_name, class_name_len);
|
||||
found = zend_lookup_class_ex(class_name, class_name_len, NULL, autoload, &ce TSRMLS_CC);
|
||||
|
||||
found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
|
||||
free_alloca(lc_name, use_heap);
|
||||
} else {
|
||||
found = zend_lookup_class(class_name, class_name_len, &ce TSRMLS_CC);
|
||||
}
|
||||
if (found == SUCCESS) {
|
||||
if ((*ce)->type == ZEND_USER_CLASS) {
|
||||
if (zend_register_class_alias_ex(alias_name, alias_name_len, *ce TSRMLS_CC) == SUCCESS) {
|
||||
@@ -1926,6 +1919,11 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
|
||||
zval *name_array = (zval *)arg;
|
||||
zval *const_val;
|
||||
|
||||
if (!constant->name) {
|
||||
/* skip special constants */
|
||||
return 0;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(const_val);
|
||||
*const_val = constant->value;
|
||||
zval_copy_ctor(const_val);
|
||||
@@ -1993,11 +1991,16 @@ ZEND_FUNCTION(get_defined_constants)
|
||||
while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) {
|
||||
zval *const_val;
|
||||
|
||||
if (!val->name) {
|
||||
/* skip special constants */
|
||||
goto next_constant;
|
||||
}
|
||||
|
||||
if (val->module_number == PHP_USER_CONSTANT) {
|
||||
module_number = i;
|
||||
} else if (val->module_number > i || val->module_number < 0) {
|
||||
/* should not happen */
|
||||
goto bad_module_id;
|
||||
goto next_constant;
|
||||
} else {
|
||||
module_number = val->module_number;
|
||||
}
|
||||
@@ -2014,7 +2017,7 @@ ZEND_FUNCTION(get_defined_constants)
|
||||
INIT_PZVAL(const_val);
|
||||
|
||||
add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val);
|
||||
bad_module_id:
|
||||
next_constant:
|
||||
zend_hash_move_forward_ex(EG(zend_constants), &pos);
|
||||
}
|
||||
efree(module_names);
|
||||
@@ -2386,7 +2389,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
|
||||
MAKE_STD_ZVAL(arg_array);
|
||||
array_init(arg_array);
|
||||
|
||||
/* include_filename always points to the last filename of the last last called-fuction.
|
||||
/* include_filename always points to the last filename of the last last called-function.
|
||||
if we have called include in the frame above - this is the file we have included.
|
||||
*/
|
||||
|
||||
|
||||
+4
-3
@@ -905,6 +905,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
|
||||
&& (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
|
||||
&& ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
|
||||
&& (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
|
||||
&& (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
|
||||
&& !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) {
|
||||
@@ -1723,7 +1724,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
|
||||
}
|
||||
|
||||
{
|
||||
/* Push a seperator to the switch and foreach stacks */
|
||||
/* Push a separator to the switch and foreach stacks */
|
||||
zend_switch_entry switch_entry;
|
||||
|
||||
switch_entry.cond.op_type = IS_UNUSED;
|
||||
@@ -1817,7 +1818,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /*
|
||||
CG(active_op_array) = function_token->u.op_array;
|
||||
|
||||
|
||||
/* Pop the switch and foreach seperators */
|
||||
/* Pop the switch and foreach separators */
|
||||
zend_stack_del_top(&CG(switch_cond_stack));
|
||||
zend_stack_del_top(&CG(foreach_copy_stack));
|
||||
}
|
||||
@@ -2584,7 +2585,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
|
||||
{
|
||||
zend_op *opline;
|
||||
|
||||
/* If we reach the seperator then stop applying the stack */
|
||||
/* If we reach the separator then stop applying the stack */
|
||||
if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
+11
-13
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef HAVE_DTRACE
|
||||
/* PHP DTrace probes {{{ */
|
||||
static inline char *dtrace_get_executed_filename(TSRMLS_D)
|
||||
static inline const char *dtrace_get_executed_filename(TSRMLS_D)
|
||||
{
|
||||
if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
|
||||
return EG(current_execute_data)->op_array->filename;
|
||||
@@ -36,9 +36,9 @@ static inline char *dtrace_get_executed_filename(TSRMLS_D)
|
||||
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
|
||||
{
|
||||
zend_op_array *res;
|
||||
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
|
||||
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
|
||||
res = compile_file(file_handle, type TSRMLS_CC);
|
||||
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
|
||||
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int t
|
||||
ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
|
||||
{
|
||||
int lineno;
|
||||
char *scope, *filename, *funcname, *classname;
|
||||
const char *scope, *filename, *funcname, *classname;
|
||||
scope = filename = funcname = classname = NULL;
|
||||
|
||||
/* we need filename and lineno for both execute and function probes */
|
||||
@@ -58,48 +58,46 @@ ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
|
||||
}
|
||||
|
||||
if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
|
||||
filename = dtrace_get_executed_filename(TSRMLS_C);
|
||||
classname = get_active_class_name(&scope TSRMLS_CC);
|
||||
funcname = get_active_function_name(TSRMLS_C);
|
||||
lineno = zend_get_executed_lineno(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
|
||||
DTRACE_EXECUTE_ENTRY(filename, lineno);
|
||||
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
|
||||
}
|
||||
|
||||
if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
|
||||
DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
|
||||
DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
|
||||
}
|
||||
|
||||
execute(op_array TSRMLS_CC);
|
||||
|
||||
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
|
||||
DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
|
||||
DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
|
||||
}
|
||||
|
||||
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
|
||||
DTRACE_EXECUTE_RETURN(filename, lineno);
|
||||
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
|
||||
{
|
||||
int lineno;
|
||||
char *filename;
|
||||
const char *filename;
|
||||
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
|
||||
filename = dtrace_get_executed_filename(TSRMLS_C);
|
||||
lineno = zend_get_executed_lineno(TSRMLS_C);
|
||||
}
|
||||
|
||||
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
|
||||
DTRACE_EXECUTE_ENTRY(filename, lineno);
|
||||
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
|
||||
}
|
||||
|
||||
execute_internal(execute_data_ptr, return_value_used TSRMLS_CC);
|
||||
|
||||
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
|
||||
DTRACE_EXECUTE_RETURN(filename, lineno);
|
||||
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,12 +85,12 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
#ifdef HAVE_DTRACE
|
||||
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
|
||||
char *classname;
|
||||
int name_len;
|
||||
const char *classname;
|
||||
zend_uint name_len;
|
||||
|
||||
if (exception != NULL) {
|
||||
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
|
||||
DTRACE_EXCEPTION_THROWN(classname);
|
||||
DTRACE_EXCEPTION_THROWN((char *)classname);
|
||||
} else {
|
||||
DTRACE_EXCEPTION_THROWN(NULL);
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_
|
||||
}
|
||||
|
||||
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
|
||||
* (doesn't impact fuctionality of __autoload()
|
||||
* (doesn't impact functionality of __autoload()
|
||||
*/
|
||||
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
|
||||
if (!key) {
|
||||
|
||||
+1
-1
@@ -306,7 +306,7 @@ struct _zend_php_scanner_globals {
|
||||
unsigned char *script_filtered;
|
||||
size_t script_filtered_size;
|
||||
|
||||
/* input/ouput filters */
|
||||
/* input/output filters */
|
||||
zend_encoding_filter input_filter;
|
||||
zend_encoding_filter output_filter;
|
||||
const zend_encoding *script_encoding;
|
||||
|
||||
@@ -41,17 +41,19 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
||||
|
||||
#define YYERROR_VERBOSE
|
||||
#define YYSTYPE znode
|
||||
#ifdef ZTS
|
||||
# define YYPARSE_PARAM tsrm_ls
|
||||
# define YYLEX_PARAM tsrm_ls
|
||||
#endif
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser
|
||||
%expect 3
|
||||
|
||||
%code requires {
|
||||
#ifdef ZTS
|
||||
# define YYPARSE_PARAM tsrm_ls
|
||||
# define YYLEX_PARAM tsrm_ls
|
||||
#endif
|
||||
}
|
||||
|
||||
%token END 0 "end of file"
|
||||
%left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE
|
||||
%token T_INCLUDE "include (T_INCLUDE)"
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct _zend_lex_state {
|
||||
unsigned char *script_filtered;
|
||||
size_t script_filtered_size;
|
||||
|
||||
/* input/ouput filters */
|
||||
/* input/output filters */
|
||||
zend_encoding_filter input_filter;
|
||||
zend_encoding_filter output_filter;
|
||||
const zend_encoding *script_encoding;
|
||||
|
||||
@@ -57,6 +57,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
obj->dtor(obj->object, i TSRMLS_CC);
|
||||
obj = &objects->object_buckets[i].bucket.obj;
|
||||
obj->refcount--;
|
||||
|
||||
if (obj->refcount == 0) {
|
||||
/* in case gc_collect_cycle is triggered before free_storage */
|
||||
GC_REMOVE_ZOBJ_FROM_BUFFER(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -2910,9 +2910,12 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2981,7 +2984,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
|
||||
|
||||
#ifdef HAVE_DTRACE
|
||||
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
|
||||
DTRACE_EXCEPTION_CAUGHT(ce->name);
|
||||
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
|
||||
}
|
||||
#endif /* HAVE_DTRACE */
|
||||
|
||||
|
||||
+25
-13
@@ -2324,9 +2324,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -6276,7 +6279,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
|
||||
|
||||
#ifdef HAVE_DTRACE
|
||||
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
|
||||
DTRACE_EXCEPTION_CAUGHT(ce->name);
|
||||
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
|
||||
}
|
||||
#endif /* HAVE_DTRACE */
|
||||
|
||||
@@ -6743,9 +6746,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -11055,9 +11061,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -27030,9 +27039,12 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
} else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) {
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EG(return_value_ptr_ptr)) {
|
||||
retval_ptr = *retval_ptr_ptr;
|
||||
*EG(return_value_ptr_ptr) = retval_ptr;
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
zval *ret;
|
||||
|
||||
ALLOC_ZVAL(ret);
|
||||
INIT_PZVAL_COPY(ret, *retval_ptr_ptr);
|
||||
zval_copy_ctor(ret);
|
||||
*EG(return_value_ptr_ptr) = ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+46
-5
@@ -2925,14 +2925,17 @@ dnl providerdesc
|
||||
dnl header-file
|
||||
ac_hdrobj=$2
|
||||
|
||||
dnl Add providerdesc.o into global objects when needed
|
||||
dnl Add providerdesc.o or .lo into global objects when needed
|
||||
case $host_alias in
|
||||
*freebsd*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
|
||||
;;
|
||||
*solaris*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
||||
;;
|
||||
*linux*)
|
||||
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -2959,15 +2962,53 @@ dnl DTrace objects
|
||||
esac
|
||||
|
||||
dnl Generate Makefile.objects entries
|
||||
dnl The empty $ac_provsrc command stops an implicit circular dependency
|
||||
dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
|
||||
cat>>Makefile.objects<<EOF
|
||||
|
||||
$abs_srcdir/$ac_provsrc:;
|
||||
|
||||
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
|
||||
dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && \$(SED) -ibak 's,PHP_,DTRACE_,g' \$[]@
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
|
||||
|
||||
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
|
||||
|
||||
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
||||
dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
||||
EOF
|
||||
|
||||
case $host_alias in
|
||||
*solaris*|*linux*)
|
||||
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
|
||||
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
|
||||
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
|
||||
dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
|
||||
for ac_lo in $PHP_DTRACE_OBJS; do
|
||||
dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
|
||||
done;
|
||||
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
|
||||
cat>>Makefile.objects<<EOF
|
||||
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
|
||||
echo "[#] Generated by Makefile for libtool" > \$[]@
|
||||
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
|
||||
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
|
||||
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
|
||||
else [\\]
|
||||
echo "pic_object='none'" >> \$[]@ [;\\]
|
||||
fi
|
||||
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
|
||||
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
|
||||
else [\\]
|
||||
echo "non_pic_object='none'" >> \$[]@ [;\\]
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
||||
;;
|
||||
*)
|
||||
cat>>Makefile.objects<<EOF
|
||||
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
|
||||
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
|
||||
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
])
|
||||
+3
-3
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=4
|
||||
PHP_RELEASE_VERSION=18
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=22
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
@@ -1582,7 +1582,7 @@ cat <<X
|
||||
| see the file debug.log for error messages. |
|
||||
| |
|
||||
| If you are unable to fix this, send the file debug.log to the |
|
||||
| php-install@lists.php.net mailing list and include appropiate |
|
||||
| php-install@lists.php.net mailing list and include appropriate |
|
||||
| information about your setup. |
|
||||
X
|
||||
fi
|
||||
|
||||
@@ -97,6 +97,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
|
||||
status = BZ2_bzDecompressInit(streamp, 0, data->small_footprint);
|
||||
|
||||
if (BZ_OK != status) {
|
||||
php_stream_bucket_delref(bucket TSRMLS_CC);
|
||||
return PSFS_ERR_FATAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1068,7 +1068,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
|
||||
{
|
||||
php_curl *ch = (php_curl *) clientp;
|
||||
php_curl_progress *t = ch->handlers->progress;
|
||||
int length = -1;
|
||||
size_t rval = 0;
|
||||
|
||||
#if PHP_CURL_DEBUG
|
||||
@@ -1118,7 +1117,6 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
|
||||
ch->in_callback = 0;
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
@@ -1373,9 +1371,9 @@ static void curl_free_post(void **post)
|
||||
|
||||
/* {{{ curl_free_slist
|
||||
*/
|
||||
static void curl_free_slist(void **slist)
|
||||
static void curl_free_slist(void *slist)
|
||||
{
|
||||
curl_slist_free_all((struct curl_slist *) *slist);
|
||||
curl_slist_free_all(*((struct curl_slist **) slist));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1443,8 +1441,10 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
(*ch)->handlers->read->stream = NULL;
|
||||
|
||||
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
|
||||
zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
|
||||
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
|
||||
|
||||
(*ch)->to_free->slist = emalloc(sizeof(HashTable));
|
||||
zend_hash_init((*ch)->to_free->slist, 4, NULL, curl_free_slist, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1675,6 +1675,7 @@ PHP_FUNCTION(curl_copy_handle)
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
|
||||
curl_easy_setopt(dupch->cp, CURLOPT_PROGRESSDATA, (void *) dupch);
|
||||
|
||||
efree(dupch->to_free->slist);
|
||||
efree(dupch->to_free);
|
||||
dupch->to_free = ch->to_free;
|
||||
|
||||
@@ -2184,7 +2185,7 @@ string_copy:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
zend_llist_add_element(&ch->to_free->slist, &slist);
|
||||
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, slist);
|
||||
|
||||
@@ -2680,8 +2681,9 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
|
||||
/* cURL destructors should be invoked only by last curl handle */
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
zend_llist_clean(&ch->to_free->str);
|
||||
zend_llist_clean(&ch->to_free->slist);
|
||||
zend_llist_clean(&ch->to_free->post);
|
||||
zend_hash_destroy(ch->to_free->slist);
|
||||
efree(ch->to_free->slist);
|
||||
efree(ch->to_free);
|
||||
FREE_ZVAL(ch->clone);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ struct _php_curl_send_headers {
|
||||
struct _php_curl_free {
|
||||
zend_llist str;
|
||||
zend_llist post;
|
||||
zend_llist slist;
|
||||
HashTable *slist;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #65458 (curl memory leak)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('curl')) exit("skip curl extension not loaded");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ch = curl_init();
|
||||
$init = memory_get_usage();
|
||||
for ($i = 0; $i < 10000; $i++) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
|
||||
}
|
||||
|
||||
$preclose = memory_get_usage();
|
||||
curl_close($ch);
|
||||
|
||||
// This is a slightly tricky heuristic, but basically, we want to ensure
|
||||
// $preclose - $init has a delta in the order of bytes, not megabytes. Given
|
||||
// the number of iterations in the loop, if we're wasting memory here, we
|
||||
// should have megs and megs of extra allocations.
|
||||
var_dump(($preclose - $init) < 10000);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
+102
-101
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */
|
||||
/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -651,7 +651,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
char *begin = *ptr, *end;
|
||||
const timelib_relunit *tp, *value = NULL;
|
||||
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
|
||||
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
@@ -871,11 +872,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 997 "ext/date/lib/parse_date.re"
|
||||
#line 998 "ext/date/lib/parse_date.re"
|
||||
|
||||
|
||||
|
||||
#line 879 "ext/date/lib/parse_date.c"
|
||||
#line 880 "ext/date/lib/parse_date.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@@ -995,7 +996,7 @@ std:
|
||||
}
|
||||
yy2:
|
||||
YYDEBUG(2, *YYCURSOR);
|
||||
#line 1083 "ext/date/lib/parse_date.re"
|
||||
#line 1084 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("firstdayof | lastdayof");
|
||||
TIMELIB_INIT;
|
||||
@@ -1011,7 +1012,7 @@ yy2:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 1015 "ext/date/lib/parse_date.c"
|
||||
#line 1016 "ext/date/lib/parse_date.c"
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -1034,7 +1035,7 @@ yy3:
|
||||
}
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
#line 1677 "ext/date/lib/parse_date.re"
|
||||
#line 1678 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@@ -1047,7 +1048,7 @@ yy4:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 1051 "ext/date/lib/parse_date.c"
|
||||
#line 1052 "ext/date/lib/parse_date.c"
|
||||
yy5:
|
||||
YYDEBUG(5, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -1358,12 +1359,12 @@ yy12:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
#line 1772 "ext/date/lib/parse_date.re"
|
||||
#line 1773 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1367 "ext/date/lib/parse_date.c"
|
||||
#line 1368 "ext/date/lib/parse_date.c"
|
||||
yy14:
|
||||
YYDEBUG(14, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2420,11 +2421,11 @@ yy49:
|
||||
if (yych <= '9') goto yy55;
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
#line 1761 "ext/date/lib/parse_date.re"
|
||||
#line 1762 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2428 "ext/date/lib/parse_date.c"
|
||||
#line 2429 "ext/date/lib/parse_date.c"
|
||||
yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2433,12 +2434,12 @@ yy52:
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
#line 1766 "ext/date/lib/parse_date.re"
|
||||
#line 1767 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2442 "ext/date/lib/parse_date.c"
|
||||
#line 2443 "ext/date/lib/parse_date.c"
|
||||
yy54:
|
||||
YYDEBUG(54, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -2825,7 +2826,7 @@ yy72:
|
||||
if (yych == 's') goto yy74;
|
||||
yy73:
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
#line 1745 "ext/date/lib/parse_date.re"
|
||||
#line 1746 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@@ -2840,7 +2841,7 @@ yy73:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2844 "ext/date/lib/parse_date.c"
|
||||
#line 2845 "ext/date/lib/parse_date.c"
|
||||
yy74:
|
||||
YYDEBUG(74, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -3602,7 +3603,7 @@ yy166:
|
||||
}
|
||||
yy167:
|
||||
YYDEBUG(167, *YYCURSOR);
|
||||
#line 1608 "ext/date/lib/parse_date.re"
|
||||
#line 1609 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@@ -3619,7 +3620,7 @@ yy167:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3623 "ext/date/lib/parse_date.c"
|
||||
#line 3624 "ext/date/lib/parse_date.c"
|
||||
yy168:
|
||||
YYDEBUG(168, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -4139,7 +4140,7 @@ yy193:
|
||||
}
|
||||
yy194:
|
||||
YYDEBUG(194, *YYCURSOR);
|
||||
#line 1667 "ext/date/lib/parse_date.re"
|
||||
#line 1668 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@@ -4148,7 +4149,7 @@ yy194:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4152 "ext/date/lib/parse_date.c"
|
||||
#line 4153 "ext/date/lib/parse_date.c"
|
||||
yy195:
|
||||
YYDEBUG(195, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -4199,7 +4200,7 @@ yy198:
|
||||
}
|
||||
yy199:
|
||||
YYDEBUG(199, *YYCURSOR);
|
||||
#line 1413 "ext/date/lib/parse_date.re"
|
||||
#line 1414 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
@@ -4212,7 +4213,7 @@ yy199:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4216 "ext/date/lib/parse_date.c"
|
||||
#line 4217 "ext/date/lib/parse_date.c"
|
||||
yy200:
|
||||
YYDEBUG(200, *YYCURSOR);
|
||||
yyaccept = 6;
|
||||
@@ -4481,7 +4482,7 @@ yy222:
|
||||
}
|
||||
yy223:
|
||||
YYDEBUG(223, *YYCURSOR);
|
||||
#line 1715 "ext/date/lib/parse_date.re"
|
||||
#line 1716 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@@ -4510,7 +4511,7 @@ yy223:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4514 "ext/date/lib/parse_date.c"
|
||||
#line 4515 "ext/date/lib/parse_date.c"
|
||||
yy224:
|
||||
YYDEBUG(224, *YYCURSOR);
|
||||
yyaccept = 7;
|
||||
@@ -5208,7 +5209,7 @@ yy278:
|
||||
YYDEBUG(278, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(279, *YYCURSOR);
|
||||
#line 1691 "ext/date/lib/parse_date.re"
|
||||
#line 1692 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -5231,7 +5232,7 @@ yy278:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 5235 "ext/date/lib/parse_date.c"
|
||||
#line 5236 "ext/date/lib/parse_date.c"
|
||||
yy280:
|
||||
YYDEBUG(280, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -5409,7 +5410,7 @@ yy294:
|
||||
++YYCURSOR;
|
||||
yy295:
|
||||
YYDEBUG(295, *YYCURSOR);
|
||||
#line 1385 "ext/date/lib/parse_date.re"
|
||||
#line 1386 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
@@ -5422,7 +5423,7 @@ yy295:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5426 "ext/date/lib/parse_date.c"
|
||||
#line 5427 "ext/date/lib/parse_date.c"
|
||||
yy296:
|
||||
YYDEBUG(296, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -6642,7 +6643,7 @@ yy362:
|
||||
if (yych <= '9') goto yy365;
|
||||
yy364:
|
||||
YYDEBUG(364, *YYCURSOR);
|
||||
#line 1529 "ext/date/lib/parse_date.re"
|
||||
#line 1530 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
@@ -6655,7 +6656,7 @@ yy364:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6659 "ext/date/lib/parse_date.c"
|
||||
#line 6660 "ext/date/lib/parse_date.c"
|
||||
yy365:
|
||||
YYDEBUG(365, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -7293,7 +7294,7 @@ yy392:
|
||||
}
|
||||
yy393:
|
||||
YYDEBUG(393, *YYCURSOR);
|
||||
#line 1587 "ext/date/lib/parse_date.re"
|
||||
#line 1588 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@@ -7313,7 +7314,7 @@ yy393:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 7317 "ext/date/lib/parse_date.c"
|
||||
#line 7318 "ext/date/lib/parse_date.c"
|
||||
yy394:
|
||||
YYDEBUG(394, *YYCURSOR);
|
||||
yyaccept = 5;
|
||||
@@ -9063,7 +9064,7 @@ yy454:
|
||||
++YYCURSOR;
|
||||
yy455:
|
||||
YYDEBUG(455, *YYCURSOR);
|
||||
#line 1290 "ext/date/lib/parse_date.re"
|
||||
#line 1291 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@@ -9074,7 +9075,7 @@ yy455:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 9078 "ext/date/lib/parse_date.c"
|
||||
#line 9079 "ext/date/lib/parse_date.c"
|
||||
yy456:
|
||||
YYDEBUG(456, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -9634,7 +9635,7 @@ yy475:
|
||||
}
|
||||
yy476:
|
||||
YYDEBUG(476, *YYCURSOR);
|
||||
#line 1427 "ext/date/lib/parse_date.re"
|
||||
#line 1428 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@@ -9645,7 +9646,7 @@ yy476:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9649 "ext/date/lib/parse_date.c"
|
||||
#line 9650 "ext/date/lib/parse_date.c"
|
||||
yy477:
|
||||
YYDEBUG(477, *YYCURSOR);
|
||||
yyaccept = 10;
|
||||
@@ -9786,7 +9787,7 @@ yy488:
|
||||
YYDEBUG(488, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(489, *YYCURSOR);
|
||||
#line 1145 "ext/date/lib/parse_date.re"
|
||||
#line 1146 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@@ -9802,7 +9803,7 @@ yy488:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9806 "ext/date/lib/parse_date.c"
|
||||
#line 9807 "ext/date/lib/parse_date.c"
|
||||
yy490:
|
||||
YYDEBUG(490, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -9815,7 +9816,7 @@ yy490:
|
||||
}
|
||||
yy491:
|
||||
YYDEBUG(491, *YYCURSOR);
|
||||
#line 1182 "ext/date/lib/parse_date.re"
|
||||
#line 1183 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@@ -9840,7 +9841,7 @@ yy491:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9844 "ext/date/lib/parse_date.c"
|
||||
#line 9845 "ext/date/lib/parse_date.c"
|
||||
yy492:
|
||||
YYDEBUG(492, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10150,7 +10151,7 @@ yy523:
|
||||
YYDEBUG(523, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(524, *YYCURSOR);
|
||||
#line 1162 "ext/date/lib/parse_date.re"
|
||||
#line 1163 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("mssqltime");
|
||||
TIMELIB_INIT;
|
||||
@@ -10169,7 +10170,7 @@ yy523:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 10173 "ext/date/lib/parse_date.c"
|
||||
#line 10174 "ext/date/lib/parse_date.c"
|
||||
yy525:
|
||||
YYDEBUG(525, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -10275,7 +10276,7 @@ yy534:
|
||||
if (yych <= '9') goto yy541;
|
||||
yy535:
|
||||
YYDEBUG(535, *YYCURSOR);
|
||||
#line 1344 "ext/date/lib/parse_date.re"
|
||||
#line 1345 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
@@ -10289,7 +10290,7 @@ yy535:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 10293 "ext/date/lib/parse_date.c"
|
||||
#line 10294 "ext/date/lib/parse_date.c"
|
||||
yy536:
|
||||
YYDEBUG(536, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -11026,7 +11027,7 @@ yy605:
|
||||
YYDEBUG(606, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(607, *YYCURSOR);
|
||||
#line 1359 "ext/date/lib/parse_date.re"
|
||||
#line 1360 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@@ -11037,7 +11038,7 @@ yy605:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11041 "ext/date/lib/parse_date.c"
|
||||
#line 11042 "ext/date/lib/parse_date.c"
|
||||
yy608:
|
||||
YYDEBUG(608, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11073,7 +11074,7 @@ yy611:
|
||||
if (yych <= '9') goto yy605;
|
||||
yy612:
|
||||
YYDEBUG(612, *YYCURSOR);
|
||||
#line 1371 "ext/date/lib/parse_date.re"
|
||||
#line 1372 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
@@ -11086,7 +11087,7 @@ yy612:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11090 "ext/date/lib/parse_date.c"
|
||||
#line 11091 "ext/date/lib/parse_date.c"
|
||||
yy613:
|
||||
YYDEBUG(613, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@@ -11727,7 +11728,7 @@ yy656:
|
||||
}
|
||||
yy657:
|
||||
YYDEBUG(657, *YYCURSOR);
|
||||
#line 1330 "ext/date/lib/parse_date.re"
|
||||
#line 1331 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
@@ -11740,7 +11741,7 @@ yy657:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11744 "ext/date/lib/parse_date.c"
|
||||
#line 11745 "ext/date/lib/parse_date.c"
|
||||
yy658:
|
||||
YYDEBUG(658, *YYCURSOR);
|
||||
yyaccept = 13;
|
||||
@@ -11846,7 +11847,7 @@ yy666:
|
||||
}
|
||||
yy667:
|
||||
YYDEBUG(667, *YYCURSOR);
|
||||
#line 1274 "ext/date/lib/parse_date.re"
|
||||
#line 1275 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
@@ -11861,7 +11862,7 @@ yy667:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11865 "ext/date/lib/parse_date.c"
|
||||
#line 11866 "ext/date/lib/parse_date.c"
|
||||
yy668:
|
||||
YYDEBUG(668, *YYCURSOR);
|
||||
yyaccept = 14;
|
||||
@@ -12094,7 +12095,7 @@ yy700:
|
||||
if (yych <= ':') goto yy704;
|
||||
yy701:
|
||||
YYDEBUG(701, *YYCURSOR);
|
||||
#line 1557 "ext/date/lib/parse_date.re"
|
||||
#line 1558 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@@ -12114,7 +12115,7 @@ yy701:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12118 "ext/date/lib/parse_date.c"
|
||||
#line 12119 "ext/date/lib/parse_date.c"
|
||||
yy702:
|
||||
YYDEBUG(702, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12666,7 +12667,7 @@ yy763:
|
||||
}
|
||||
yy764:
|
||||
YYDEBUG(764, *YYCURSOR);
|
||||
#line 1302 "ext/date/lib/parse_date.re"
|
||||
#line 1303 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
@@ -12679,7 +12680,7 @@ yy764:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 12683 "ext/date/lib/parse_date.c"
|
||||
#line 12684 "ext/date/lib/parse_date.c"
|
||||
yy765:
|
||||
YYDEBUG(765, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12718,7 +12719,7 @@ yy771:
|
||||
YYDEBUG(771, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(772, *YYCURSOR);
|
||||
#line 1543 "ext/date/lib/parse_date.re"
|
||||
#line 1544 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
@@ -12731,7 +12732,7 @@ yy771:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 12735 "ext/date/lib/parse_date.c"
|
||||
#line 12736 "ext/date/lib/parse_date.c"
|
||||
yy773:
|
||||
YYDEBUG(773, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -12869,7 +12870,7 @@ yy783:
|
||||
}
|
||||
yy784:
|
||||
YYDEBUG(784, *YYCURSOR);
|
||||
#line 1578 "ext/date/lib/parse_date.re"
|
||||
#line 1579 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@@ -12877,7 +12878,7 @@ yy784:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12881 "ext/date/lib/parse_date.c"
|
||||
#line 12882 "ext/date/lib/parse_date.c"
|
||||
yy785:
|
||||
YYDEBUG(785, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13028,7 +13029,7 @@ yy793:
|
||||
}
|
||||
yy794:
|
||||
YYDEBUG(794, *YYCURSOR);
|
||||
#line 1399 "ext/date/lib/parse_date.re"
|
||||
#line 1400 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
@@ -13041,7 +13042,7 @@ yy794:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 13045 "ext/date/lib/parse_date.c"
|
||||
#line 13046 "ext/date/lib/parse_date.c"
|
||||
yy795:
|
||||
YYDEBUG(795, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13256,7 +13257,7 @@ yy814:
|
||||
if (yych <= '7') goto yy817;
|
||||
yy815:
|
||||
YYDEBUG(815, *YYCURSOR);
|
||||
#line 1510 "ext/date/lib/parse_date.re"
|
||||
#line 1511 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@@ -13274,7 +13275,7 @@ yy815:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13278 "ext/date/lib/parse_date.c"
|
||||
#line 13279 "ext/date/lib/parse_date.c"
|
||||
yy816:
|
||||
YYDEBUG(816, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13284,7 +13285,7 @@ yy817:
|
||||
YYDEBUG(817, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(818, *YYCURSOR);
|
||||
#line 1491 "ext/date/lib/parse_date.re"
|
||||
#line 1492 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@@ -13302,7 +13303,7 @@ yy817:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13306 "ext/date/lib/parse_date.c"
|
||||
#line 13307 "ext/date/lib/parse_date.c"
|
||||
yy819:
|
||||
YYDEBUG(819, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13366,7 +13367,7 @@ yy821:
|
||||
}
|
||||
yy822:
|
||||
YYDEBUG(822, *YYCURSOR);
|
||||
#line 1477 "ext/date/lib/parse_date.re"
|
||||
#line 1478 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
@@ -13379,7 +13380,7 @@ yy822:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 13383 "ext/date/lib/parse_date.c"
|
||||
#line 13384 "ext/date/lib/parse_date.c"
|
||||
yy823:
|
||||
YYDEBUG(823, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13482,7 +13483,7 @@ yy842:
|
||||
++YYCURSOR;
|
||||
yy843:
|
||||
YYDEBUG(843, *YYCURSOR);
|
||||
#line 1451 "ext/date/lib/parse_date.re"
|
||||
#line 1452 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@@ -13507,7 +13508,7 @@ yy843:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 13511 "ext/date/lib/parse_date.c"
|
||||
#line 13512 "ext/date/lib/parse_date.c"
|
||||
yy844:
|
||||
YYDEBUG(844, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -13769,7 +13770,7 @@ yy848:
|
||||
}
|
||||
yy849:
|
||||
YYDEBUG(849, *YYCURSOR);
|
||||
#line 1439 "ext/date/lib/parse_date.re"
|
||||
#line 1440 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -13780,7 +13781,7 @@ yy849:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 13784 "ext/date/lib/parse_date.c"
|
||||
#line 13785 "ext/date/lib/parse_date.c"
|
||||
yy850:
|
||||
YYDEBUG(850, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -14700,7 +14701,7 @@ yy973:
|
||||
if (yych <= '9') goto yy996;
|
||||
yy974:
|
||||
YYDEBUG(974, *YYCURSOR);
|
||||
#line 1316 "ext/date/lib/parse_date.re"
|
||||
#line 1317 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
@@ -14713,7 +14714,7 @@ yy974:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 14717 "ext/date/lib/parse_date.c"
|
||||
#line 14718 "ext/date/lib/parse_date.c"
|
||||
yy975:
|
||||
YYDEBUG(975, *YYCURSOR);
|
||||
yyaccept = 22;
|
||||
@@ -15722,7 +15723,7 @@ yy1066:
|
||||
}
|
||||
yy1068:
|
||||
YYDEBUG(1068, *YYCURSOR);
|
||||
#line 1208 "ext/date/lib/parse_date.re"
|
||||
#line 1209 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@@ -15744,7 +15745,7 @@ yy1068:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 15748 "ext/date/lib/parse_date.c"
|
||||
#line 15749 "ext/date/lib/parse_date.c"
|
||||
yy1069:
|
||||
YYDEBUG(1069, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -15836,7 +15837,7 @@ yy1075:
|
||||
}
|
||||
yy1076:
|
||||
YYDEBUG(1076, *YYCURSOR);
|
||||
#line 1254 "ext/date/lib/parse_date.re"
|
||||
#line 1255 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@@ -15855,7 +15856,7 @@ yy1076:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 15859 "ext/date/lib/parse_date.c"
|
||||
#line 15860 "ext/date/lib/parse_date.c"
|
||||
yy1077:
|
||||
YYDEBUG(1077, *YYCURSOR);
|
||||
yyaccept = 25;
|
||||
@@ -16753,7 +16754,7 @@ yy1117:
|
||||
}
|
||||
yy1118:
|
||||
YYDEBUG(1118, *YYCURSOR);
|
||||
#line 1650 "ext/date/lib/parse_date.re"
|
||||
#line 1651 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16769,7 +16770,7 @@ yy1118:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16773 "ext/date/lib/parse_date.c"
|
||||
#line 16774 "ext/date/lib/parse_date.c"
|
||||
yy1119:
|
||||
YYDEBUG(1119, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@@ -16820,7 +16821,7 @@ yy1126:
|
||||
YYDEBUG(1126, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1127, *YYCURSOR);
|
||||
#line 1123 "ext/date/lib/parse_date.re"
|
||||
#line 1124 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16841,7 +16842,7 @@ yy1126:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 16845 "ext/date/lib/parse_date.c"
|
||||
#line 16846 "ext/date/lib/parse_date.c"
|
||||
yy1128:
|
||||
YYDEBUG(1128, *YYCURSOR);
|
||||
yyaccept = 26;
|
||||
@@ -16949,7 +16950,7 @@ yy1141:
|
||||
}
|
||||
yy1142:
|
||||
YYDEBUG(1142, *YYCURSOR);
|
||||
#line 1626 "ext/date/lib/parse_date.re"
|
||||
#line 1627 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@@ -16972,7 +16973,7 @@ yy1142:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16976 "ext/date/lib/parse_date.c"
|
||||
#line 16977 "ext/date/lib/parse_date.c"
|
||||
yy1143:
|
||||
YYDEBUG(1143, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -19649,7 +19650,7 @@ yy1294:
|
||||
goto yy1298;
|
||||
yy1295:
|
||||
YYDEBUG(1295, *YYCURSOR);
|
||||
#line 1100 "ext/date/lib/parse_date.re"
|
||||
#line 1101 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("backof | frontof");
|
||||
TIMELIB_INIT;
|
||||
@@ -19671,7 +19672,7 @@ yy1295:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19675 "ext/date/lib/parse_date.c"
|
||||
#line 19676 "ext/date/lib/parse_date.c"
|
||||
yy1296:
|
||||
YYDEBUG(1296, *YYCURSOR);
|
||||
yyaccept = 28;
|
||||
@@ -21362,7 +21363,7 @@ yy1385:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy1387:
|
||||
YYDEBUG(1387, *YYCURSOR);
|
||||
#line 1057 "ext/date/lib/parse_date.re"
|
||||
#line 1058 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
@@ -21387,7 +21388,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21391 "ext/date/lib/parse_date.c"
|
||||
#line 21392 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
YYDEBUG(1388, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21823,7 +21824,7 @@ yy1416:
|
||||
++YYCURSOR;
|
||||
yy1417:
|
||||
YYDEBUG(1417, *YYCURSOR);
|
||||
#line 1045 "ext/date/lib/parse_date.re"
|
||||
#line 1046 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("tomorrow");
|
||||
TIMELIB_INIT;
|
||||
@@ -21834,7 +21835,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21838 "ext/date/lib/parse_date.c"
|
||||
#line 21839 "ext/date/lib/parse_date.c"
|
||||
yy1418:
|
||||
YYDEBUG(1418, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -21869,7 +21870,7 @@ yy1419:
|
||||
}
|
||||
yy1420:
|
||||
YYDEBUG(1420, *YYCURSOR);
|
||||
#line 1035 "ext/date/lib/parse_date.re"
|
||||
#line 1036 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
@@ -21878,7 +21879,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21882 "ext/date/lib/parse_date.c"
|
||||
#line 21883 "ext/date/lib/parse_date.c"
|
||||
yy1421:
|
||||
YYDEBUG(1421, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -23890,7 +23891,7 @@ yy1499:
|
||||
}
|
||||
yy1500:
|
||||
YYDEBUG(1500, *YYCURSOR);
|
||||
#line 1014 "ext/date/lib/parse_date.re"
|
||||
#line 1015 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("now");
|
||||
TIMELIB_INIT;
|
||||
@@ -23898,7 +23899,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 23902 "ext/date/lib/parse_date.c"
|
||||
#line 23903 "ext/date/lib/parse_date.c"
|
||||
yy1501:
|
||||
YYDEBUG(1501, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@@ -24037,7 +24038,7 @@ yy1507:
|
||||
}
|
||||
yy1508:
|
||||
YYDEBUG(1508, *YYCURSOR);
|
||||
#line 1023 "ext/date/lib/parse_date.re"
|
||||
#line 1024 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
@@ -24048,7 +24049,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24052 "ext/date/lib/parse_date.c"
|
||||
#line 24053 "ext/date/lib/parse_date.c"
|
||||
yy1509:
|
||||
YYDEBUG(1509, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24581,7 +24582,7 @@ yy1530:
|
||||
++YYCURSOR;
|
||||
yy1531:
|
||||
YYDEBUG(1531, *YYCURSOR);
|
||||
#line 1002 "ext/date/lib/parse_date.re"
|
||||
#line 1003 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("yesterday");
|
||||
TIMELIB_INIT;
|
||||
@@ -24592,7 +24593,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24596 "ext/date/lib/parse_date.c"
|
||||
#line 24597 "ext/date/lib/parse_date.c"
|
||||
yy1532:
|
||||
YYDEBUG(1532, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@@ -24765,7 +24766,7 @@ yy1537:
|
||||
goto yy1531;
|
||||
}
|
||||
}
|
||||
#line 1776 "ext/date/lib/parse_date.re"
|
||||
#line 1777 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
@@ -25035,7 +25036,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
@@ -25123,7 +25124,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
break;
|
||||
|
||||
case '\\': /* escaped char */
|
||||
*fptr++;
|
||||
fptr++;
|
||||
if (*ptr == *fptr) {
|
||||
++ptr;
|
||||
} else {
|
||||
|
||||
@@ -649,7 +649,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
char *begin = *ptr, *end;
|
||||
const timelib_relunit *tp, *value = NULL;
|
||||
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
|
||||
while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
|
||||
**ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
@@ -2042,7 +2043,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
@@ -2130,7 +2131,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
break;
|
||||
|
||||
case '\\': /* escaped char */
|
||||
*fptr++;
|
||||
fptr++;
|
||||
if (*ptr == *fptr) {
|
||||
++ptr;
|
||||
} else {
|
||||
|
||||
+922
-930
File diff suppressed because it is too large.
Load diff
+15
-10
@@ -997,7 +997,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
|
||||
{
|
||||
smart_str string = {0};
|
||||
int i, length;
|
||||
int i, length = 0;
|
||||
char buffer[97];
|
||||
timelib_time_offset *offset = NULL;
|
||||
timelib_sll isoweek, isoyear;
|
||||
@@ -1352,7 +1352,7 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_parse_date: Backwards compability function */
|
||||
/* {{{ php_parse_date: Backwards compatibility function */
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
{
|
||||
timelib_time *parsed_time;
|
||||
@@ -1362,6 +1362,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)
|
||||
|
||||
parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
|
||||
if (error->error_count) {
|
||||
timelib_time_dtor(parsed_time);
|
||||
timelib_error_container_dtor(error);
|
||||
return -1;
|
||||
}
|
||||
@@ -2113,13 +2114,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||
/* first we add the date and time in ISO format */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
|
||||
zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL);
|
||||
zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
|
||||
|
||||
/* then we add the timezone name (or similar) */
|
||||
if (dateobj->time->is_localtime) {
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, dateobj->time->zone_type);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
|
||||
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
|
||||
|
||||
MAKE_STD_ZVAL(zv);
|
||||
switch (dateobj->time->zone_type) {
|
||||
@@ -2142,7 +2143,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||
ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
|
||||
break;
|
||||
}
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
|
||||
zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
|
||||
}
|
||||
|
||||
return props;
|
||||
@@ -2265,7 +2266,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
|
||||
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
|
||||
MAKE_STD_ZVAL(zv); \
|
||||
ZVAL_LONG(zv, (long)intervalobj->diff->f); \
|
||||
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
|
||||
zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
|
||||
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
|
||||
@@ -2282,7 +2283,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
|
||||
} else {
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_FALSE(zv);
|
||||
zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL);
|
||||
zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
|
||||
}
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
|
||||
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
|
||||
@@ -2409,8 +2410,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
timelib_time *now;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
timelib_error_container *err = NULL;
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst;
|
||||
char *new_abbr;
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
|
||||
char *new_abbr = NULL;
|
||||
timelib_sll new_offset;
|
||||
|
||||
if (dateobj->time) {
|
||||
@@ -3568,7 +3569,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
|
||||
ALLOC_INIT_ZVAL(retval);
|
||||
Z_SET_REFCOUNT_P(retval, 0);
|
||||
|
||||
ZVAL_LONG(retval, value);
|
||||
if (value != -99999) {
|
||||
ZVAL_LONG(retval, value);
|
||||
} else {
|
||||
ZVAL_FALSE(retval);
|
||||
}
|
||||
|
||||
if (member == &tmp_member) {
|
||||
zval_dtor(member);
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ ZEND_END_MODULE_GLOBALS(date)
|
||||
#define DATEG(v) (date_globals.v)
|
||||
#endif
|
||||
|
||||
/* Backwards compability wrapper */
|
||||
/* Backwards compatibility wrapper */
|
||||
PHPAPI signed long php_parse_date(char *string, signed long *now);
|
||||
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
|
||||
PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Wrong var_dump(DateInterval->days) value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$interval = new DateInterval('P2Y4DT6H8M');
|
||||
|
||||
var_dump($interval->days);
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Test fix for DateTime when date have textual day with dot or other special char at end
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//Set the default time zone
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
echo "*** Testing clone on DateTime objects ***\n";
|
||||
|
||||
// Create a DateTime object..
|
||||
$orig = new DateTime('2012-11-29 17:00:00');
|
||||
|
||||
// String to parse
|
||||
$string = "Thu., Nov. 29, 2012 5:00PM";
|
||||
|
||||
// Create a DateTime object from format
|
||||
$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
|
||||
|
||||
echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
|
||||
echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing clone on DateTime objects ***
|
||||
Format method: Thu., Nov. 29, 2012 5:00PM
|
||||
createFromFormat method: Thu., Nov. 29, 2012 5:00PM
|
||||
===DONE===
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
DateTime::createFromFormat('s', '0');
|
||||
$lastErrors = DateTime::getLastErrors();
|
||||
print_r($lastErrors['errors'][0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
A two digit second could not be found
|
||||
+25
-10
@@ -226,12 +226,17 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
|
||||
*key_free = *key_str;
|
||||
return len;
|
||||
} else {
|
||||
*key_free = NULL;
|
||||
zval tmp = *key;
|
||||
int len;
|
||||
|
||||
convert_to_string(key);
|
||||
*key_str = Z_STRVAL_P(key);
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_string(&tmp);
|
||||
|
||||
return Z_STRLEN_P(key);
|
||||
*key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
|
||||
len = Z_STRLEN(tmp);
|
||||
|
||||
zval_dtor(&tmp);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -297,6 +302,14 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* the same check, but with a call to DBA_ID_DONE before returning */
|
||||
#define DBA_WRITE_CHECK_WITH_ID \
|
||||
if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You cannot perform a modification to a database without proper access"); \
|
||||
DBA_ID_DONE; \
|
||||
RETURN_FALSE; \
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ globals */
|
||||
@@ -538,7 +551,6 @@ PHP_MINFO_FUNCTION(dba)
|
||||
*/
|
||||
static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
{
|
||||
char *v;
|
||||
int val_len;
|
||||
zval *id;
|
||||
dba_info *info = NULL;
|
||||
@@ -558,7 +570,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
|
||||
DBA_FETCH_RESOURCE(info, &id);
|
||||
|
||||
DBA_WRITE_CHECK;
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
|
||||
if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) {
|
||||
DBA_ID_DONE;
|
||||
@@ -613,7 +625,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
char *file_mode;
|
||||
char mode[4], *pmode, *lock_file_mode = NULL;
|
||||
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
|
||||
char *opened_path, *lock_name;
|
||||
char *opened_path = NULL;
|
||||
char *lock_name;
|
||||
|
||||
if(ac < 2) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -836,8 +849,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (!persistent) {
|
||||
info->lock.name = opened_path;
|
||||
} else {
|
||||
info->lock.name = pestrdup(opened_path, persistent);
|
||||
efree(opened_path);
|
||||
if (opened_path) {
|
||||
info->lock.name = pestrdup(opened_path, persistent);
|
||||
efree(opened_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1111,7 +1126,7 @@ PHP_FUNCTION(dba_delete)
|
||||
{
|
||||
DBA_ID_GET2;
|
||||
|
||||
DBA_WRITE_CHECK;
|
||||
DBA_WRITE_CHECK_WITH_ID;
|
||||
|
||||
if(info->hnd->delete(info, key_str, key_len TSRMLS_CC) == SUCCESS)
|
||||
{
|
||||
|
||||
@@ -460,7 +460,7 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
|
||||
*/
|
||||
static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, int append TSRMLS_DC)
|
||||
{
|
||||
size_t pos_grp_start, pos_grp_next;
|
||||
size_t pos_grp_start = 0, pos_grp_next;
|
||||
inifile *ini_tmp = NULL;
|
||||
php_stream *fp_tmp = NULL;
|
||||
int ret;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on write)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(dirname(__FILE__) .'/skipif.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once(dirname(__FILE__) .'/test.inc');
|
||||
|
||||
$db = dba_popen($db_filename, 'c');
|
||||
|
||||
$key = 1;
|
||||
$copy = $key;
|
||||
|
||||
echo gettype($key)."\n";
|
||||
echo gettype($copy)."\n";
|
||||
|
||||
dba_exists($key, $db);
|
||||
|
||||
echo gettype($key)."\n";
|
||||
echo gettype($copy)."\n";
|
||||
|
||||
dba_close($db);
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require(dirname(__FILE__) .'/clean.inc');
|
||||
?>
|
||||
--EXPECT--
|
||||
integer
|
||||
integer
|
||||
integer
|
||||
integer
|
||||
@@ -1089,7 +1089,11 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
|
||||
void dom_objects_free_storage(void *object TSRMLS_DC)
|
||||
{
|
||||
dom_object *intern = (dom_object *)object;
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
int retcount __attribute__((unused)); /* keep compiler quiet */
|
||||
#else
|
||||
int retcount;
|
||||
#endif
|
||||
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #44648 (Attribute names not checked for wellformedness)
|
||||
Bug #44648 (Attribute names not checked for well formedness)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
|
||||
|
||||
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
|
||||
{
|
||||
zval **args;
|
||||
zval **args = NULL;
|
||||
zval *retval;
|
||||
int result, i, ret;
|
||||
int error = 0;
|
||||
|
||||
+7
-5
@@ -2643,6 +2643,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
} else {
|
||||
decode = ImageInfo->decode_unicode_le;
|
||||
}
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
@@ -2650,7 +2651,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(decode TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
return len;
|
||||
@@ -2663,6 +2664,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
@@ -2670,7 +2672,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
return len;
|
||||
@@ -2700,8 +2702,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
|
||||
/* Copy the comment */
|
||||
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
@@ -2709,7 +2711,7 @@ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_fi
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC)
|
||||
TSRMLS_CC) < 0) {
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount);
|
||||
}
|
||||
return xp_field->size;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
||||
<html><head>
|
||||
<title>301 Moved Permanently</title>
|
||||
</head><body>
|
||||
<h1>Moved Permanently</h1>
|
||||
<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
|
||||
<hr>
|
||||
<address>Apache Server at getid3.org Port 80</address>
|
||||
</body></html>
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
|
||||
int(1)
|
||||
Done
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 504 KiB |
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
Test
|
||||
int(76)
|
||||
Done
|
||||
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head><title>Found</title></head>
|
||||
<body>
|
||||
<h1>Found</h1>
|
||||
<p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
|
||||
you should be redirected automatically.
|
||||
|
||||
<!-- --></p>
|
||||
<hr noshade>
|
||||
<div align="right">WSGI Server</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 62523 (php crashes with segfault when exif_read_data called)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Test
|
||||
|
||||
Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
|
||||
int(1)
|
||||
Done
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
PHP crash when zend_multibyte_encoding_converter returns (size_t)-1)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = dirname(__FILE__).'/exif_encoding_crash.jpg';
|
||||
$exif_data = exif_read_data($infile);
|
||||
echo "*** no core dump ***\n";
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
*** no core dump ***
|
||||
===DONE===
|
||||
@@ -11969,7 +11969,7 @@
|
||||
#>65 string ZSYS (Pre-System 7 system file)
|
||||
#>65 string acf3 (Aldus FreeHand)
|
||||
#>65 string cdev (control panel)
|
||||
#>65 string dfil (Desk Acessory suitcase)
|
||||
#>65 string dfil (Desk Accessory suitcase)
|
||||
#>65 string libr (library)
|
||||
#>65 string nX^d (WriteNow word processor)
|
||||
#>65 string nX^w (WriteNow dictionary)
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@ PHP_MINIT_FUNCTION(filter)
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (*(e - 1) == '.') {
|
||||
goto bad_url;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -718,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (flags & FILTER_FLAG_NO_RES_RANGE) {
|
||||
if (
|
||||
(ip[0] == 0) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
|
||||
(ip[0] == 128 && ip[1] == 0) ||
|
||||
(ip[0] == 191 && ip[1] == 255) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
|
||||
@@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
|
||||
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.64.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
|
||||
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
|
||||
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
|
||||
@@ -40,6 +42,8 @@ bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
bool(false)
|
||||
string(9) "192.0.0.1"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
bool(false)
|
||||
string(15) "255.255.255.255"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
|
||||
var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
|
||||
--EXPECT--
|
||||
string(20) "http://example.com./"
|
||||
string(19) "http://example.com/"
|
||||
+23
-41
@@ -39,7 +39,7 @@
|
||||
#ifdef PHP_WIN32
|
||||
#include <winsock2.h>
|
||||
#elif defined(NETWARE)
|
||||
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */
|
||||
#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), at least for now */
|
||||
#include <novsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
@@ -612,7 +612,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
|
||||
/* {{{ ftp_alloc
|
||||
*/
|
||||
int
|
||||
ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
|
||||
ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
{
|
||||
char buffer[64];
|
||||
|
||||
@@ -620,8 +620,8 @@ ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%d", size);
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
|
||||
|
||||
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -630,7 +630,7 @@ ftp_alloc(ftpbuf_t *ftp, const int size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (response && ftp->inbuf) {
|
||||
if (response) {
|
||||
*response = estrdup(ftp->inbuf);
|
||||
}
|
||||
|
||||
@@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
/* {{{ ftp_get
|
||||
*/
|
||||
int
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
|
||||
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
int lastch;
|
||||
@@ -808,11 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
ftp->data = data;
|
||||
|
||||
if (resumepos > 0) {
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", resumepos);
|
||||
snprintf(arg, sizeof(arg), "%ld", resumepos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@@ -885,10 +881,10 @@ bail:
|
||||
/* {{{ ftp_put
|
||||
*/
|
||||
int
|
||||
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
|
||||
ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
int size;
|
||||
long size;
|
||||
char *ptr;
|
||||
int ch;
|
||||
char arg[11];
|
||||
@@ -905,11 +901,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
|
||||
ftp->data = data;
|
||||
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", startpos);
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@@ -966,7 +958,7 @@ bail:
|
||||
|
||||
/* {{{ ftp_size
|
||||
*/
|
||||
int
|
||||
long
|
||||
ftp_size(ftpbuf_t *ftp, const char *path)
|
||||
{
|
||||
if (ftp == NULL) {
|
||||
@@ -981,7 +973,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 213) {
|
||||
return -1;
|
||||
}
|
||||
return atoi(ftp->inbuf);
|
||||
return atol(ftp->inbuf);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1143,7 +1135,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
|
||||
int
|
||||
ftp_readline(ftpbuf_t *ftp)
|
||||
{
|
||||
int size, rcvd;
|
||||
long size, rcvd;
|
||||
char *data, *eol;
|
||||
|
||||
/* shift the extra to the front */
|
||||
@@ -1236,7 +1228,8 @@ ftp_getresp(ftpbuf_t *ftp)
|
||||
int
|
||||
my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
{
|
||||
int n, size, sent;
|
||||
long size, sent;
|
||||
int n;
|
||||
|
||||
size = len;
|
||||
while (size) {
|
||||
@@ -1650,7 +1643,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if (ftp->resp == 226) {
|
||||
ftp->data = data_close(ftp, data);
|
||||
php_stream_close(tmpstream);
|
||||
return ecalloc(1, sizeof(char**));
|
||||
return ecalloc(1, sizeof(char*));
|
||||
}
|
||||
|
||||
/* pull data buffer into tmpfile */
|
||||
@@ -1678,11 +1671,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
ftp->data = data = data_close(ftp, data);
|
||||
ftp->data = data_close(ftp, data);
|
||||
|
||||
php_stream_rewind(tmpstream);
|
||||
|
||||
ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*));
|
||||
ret = safe_emalloc((lines + 1), sizeof(char*), size);
|
||||
|
||||
entry = ret;
|
||||
text = (char*) (ret + lines + 1);
|
||||
@@ -1719,7 +1712,7 @@ bail:
|
||||
/* {{{ ftp_nb_get
|
||||
*/
|
||||
int
|
||||
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC)
|
||||
ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char arg[11];
|
||||
@@ -1737,14 +1730,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
|
||||
}
|
||||
|
||||
if (resumepos>0) {
|
||||
/* We are working on an architecture that supports 64-bit integers
|
||||
* since php is 32 bit by design, we bail out with warning
|
||||
*/
|
||||
if (resumepos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", resumepos);
|
||||
snprintf(arg, sizeof(arg), "%ld", resumepos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@@ -1843,7 +1829,7 @@ bail:
|
||||
/* {{{ ftp_nb_put
|
||||
*/
|
||||
int
|
||||
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC)
|
||||
ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC)
|
||||
{
|
||||
databuf_t *data = NULL;
|
||||
char arg[11];
|
||||
@@ -1858,11 +1844,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
goto bail;
|
||||
}
|
||||
if (startpos > 0) {
|
||||
if (startpos > 2147483647) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
|
||||
goto bail;
|
||||
}
|
||||
snprintf(arg, sizeof(arg), "%u", startpos);
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
if (!ftp_putcmd(ftp, "REST", arg)) {
|
||||
goto bail;
|
||||
}
|
||||
@@ -1899,7 +1881,7 @@ bail:
|
||||
int
|
||||
ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
|
||||
{
|
||||
int size;
|
||||
long size;
|
||||
char *ptr;
|
||||
int ch;
|
||||
|
||||
|
||||
+6
-6
@@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi
|
||||
* however some servers will not accept STOR or APPE until ALLO is confirmed.
|
||||
* If response is passed, it is estrdup()ed from ftp->inbuf and must be freed
|
||||
* or assigned to a zval returned to the user */
|
||||
int ftp_alloc(ftpbuf_t *ftp, const int size, char **response);
|
||||
int ftp_alloc(ftpbuf_t *ftp, const long size, char **response);
|
||||
|
||||
/* returns a NULL-terminated array of filenames in the given path
|
||||
* or NULL on error. the return array must be freed (but don't
|
||||
@@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv);
|
||||
/* retrieves a file and saves its contents to outfp
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
|
||||
int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
|
||||
|
||||
/* stores the data from a file, socket, or process as a file on the remote server
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
|
||||
int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
|
||||
|
||||
/* returns the size of the given file, or -1 on error */
|
||||
int ftp_size(ftpbuf_t *ftp, const char *path);
|
||||
long ftp_size(ftpbuf_t *ftp, const char *path);
|
||||
|
||||
/* returns the last modified time of the given file, or -1 on error */
|
||||
time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
|
||||
@@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd);
|
||||
/* retrieves part of a file and saves its contents to outfp
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC);
|
||||
int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC);
|
||||
|
||||
/* stores the data from a file, socket, or process as a file on the remote server
|
||||
* returns true on success, false on error
|
||||
*/
|
||||
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC);
|
||||
int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC);
|
||||
|
||||
/* continues a previous nb_(f)get command
|
||||
*/
|
||||
|
||||
+7
-7
@@ -784,8 +784,8 @@ PHP_FUNCTION(ftp_nb_fget)
|
||||
ftptype_t xtype;
|
||||
php_stream *stream;
|
||||
char *file;
|
||||
int file_len, ret;
|
||||
long mode, resumepos=0;
|
||||
int file_len;
|
||||
long mode, resumepos=0, ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
|
||||
return;
|
||||
@@ -968,7 +968,7 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
RETURN_LONG(PHP_FTP_FAILED);
|
||||
}
|
||||
|
||||
if (ret == PHP_FTP_FINISHED) {
|
||||
if (ret == PHP_FTP_FINISHED){
|
||||
php_stream_close(outstream);
|
||||
}
|
||||
|
||||
@@ -982,7 +982,7 @@ PHP_FUNCTION(ftp_nb_continue)
|
||||
{
|
||||
zval *z_ftp;
|
||||
ftpbuf_t *ftp;
|
||||
int ret;
|
||||
long ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) {
|
||||
return;
|
||||
@@ -1120,7 +1120,7 @@ PHP_FUNCTION(ftp_put)
|
||||
ftpbuf_t *ftp;
|
||||
ftptype_t xtype;
|
||||
char *remote, *local;
|
||||
int remote_len, local_len;
|
||||
long remote_len, local_len;
|
||||
long mode, startpos=0;
|
||||
php_stream *instream;
|
||||
|
||||
@@ -1173,8 +1173,8 @@ PHP_FUNCTION(ftp_nb_put)
|
||||
ftpbuf_t *ftp;
|
||||
ftptype_t xtype;
|
||||
char *remote, *local;
|
||||
int remote_len, local_len, ret;
|
||||
long mode, startpos=0;
|
||||
int remote_len, local_len;
|
||||
long mode, startpos=0, ret;
|
||||
php_stream *instream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Verify php can handle filesizes >32bit
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
if (2147483647 == PHP_INT_MAX) {
|
||||
die('skip 64-bit only');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
var_dump(ftp_size($ftp, 'largefile'));
|
||||
|
||||
ftp_close($ftp);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5368709120)
|
||||
@@ -0,0 +1,182 @@
|
||||
--TEST--
|
||||
Testing whether ftp_nb_continue() fetches more data
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$file = "mediumfile.txt";
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $file;
|
||||
touch($local_file);
|
||||
|
||||
$r = ftp_nb_get($ftp, $local_file, $file, FTP_BINARY);
|
||||
while ($r == FTP_MOREDATA) {
|
||||
$r = ftp_nb_continue($ftp);
|
||||
}
|
||||
ftp_close($ftp);
|
||||
|
||||
echo file_get_contents($local_file);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "mediumfile.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
This is line 0 of the test data.
|
||||
This is line 1 of the test data.
|
||||
This is line 2 of the test data.
|
||||
This is line 3 of the test data.
|
||||
This is line 4 of the test data.
|
||||
This is line 5 of the test data.
|
||||
This is line 6 of the test data.
|
||||
This is line 7 of the test data.
|
||||
This is line 8 of the test data.
|
||||
This is line 9 of the test data.
|
||||
This is line 10 of the test data.
|
||||
This is line 11 of the test data.
|
||||
This is line 12 of the test data.
|
||||
This is line 13 of the test data.
|
||||
This is line 14 of the test data.
|
||||
This is line 15 of the test data.
|
||||
This is line 16 of the test data.
|
||||
This is line 17 of the test data.
|
||||
This is line 18 of the test data.
|
||||
This is line 19 of the test data.
|
||||
This is line 20 of the test data.
|
||||
This is line 21 of the test data.
|
||||
This is line 22 of the test data.
|
||||
This is line 23 of the test data.
|
||||
This is line 24 of the test data.
|
||||
This is line 25 of the test data.
|
||||
This is line 26 of the test data.
|
||||
This is line 27 of the test data.
|
||||
This is line 28 of the test data.
|
||||
This is line 29 of the test data.
|
||||
This is line 30 of the test data.
|
||||
This is line 31 of the test data.
|
||||
This is line 32 of the test data.
|
||||
This is line 33 of the test data.
|
||||
This is line 34 of the test data.
|
||||
This is line 35 of the test data.
|
||||
This is line 36 of the test data.
|
||||
This is line 37 of the test data.
|
||||
This is line 38 of the test data.
|
||||
This is line 39 of the test data.
|
||||
This is line 40 of the test data.
|
||||
This is line 41 of the test data.
|
||||
This is line 42 of the test data.
|
||||
This is line 43 of the test data.
|
||||
This is line 44 of the test data.
|
||||
This is line 45 of the test data.
|
||||
This is line 46 of the test data.
|
||||
This is line 47 of the test data.
|
||||
This is line 48 of the test data.
|
||||
This is line 49 of the test data.
|
||||
This is line 50 of the test data.
|
||||
This is line 51 of the test data.
|
||||
This is line 52 of the test data.
|
||||
This is line 53 of the test data.
|
||||
This is line 54 of the test data.
|
||||
This is line 55 of the test data.
|
||||
This is line 56 of the test data.
|
||||
This is line 57 of the test data.
|
||||
This is line 58 of the test data.
|
||||
This is line 59 of the test data.
|
||||
This is line 60 of the test data.
|
||||
This is line 61 of the test data.
|
||||
This is line 62 of the test data.
|
||||
This is line 63 of the test data.
|
||||
This is line 64 of the test data.
|
||||
This is line 65 of the test data.
|
||||
This is line 66 of the test data.
|
||||
This is line 67 of the test data.
|
||||
This is line 68 of the test data.
|
||||
This is line 69 of the test data.
|
||||
This is line 70 of the test data.
|
||||
This is line 71 of the test data.
|
||||
This is line 72 of the test data.
|
||||
This is line 73 of the test data.
|
||||
This is line 74 of the test data.
|
||||
This is line 75 of the test data.
|
||||
This is line 76 of the test data.
|
||||
This is line 77 of the test data.
|
||||
This is line 78 of the test data.
|
||||
This is line 79 of the test data.
|
||||
This is line 80 of the test data.
|
||||
This is line 81 of the test data.
|
||||
This is line 82 of the test data.
|
||||
This is line 83 of the test data.
|
||||
This is line 84 of the test data.
|
||||
This is line 85 of the test data.
|
||||
This is line 86 of the test data.
|
||||
This is line 87 of the test data.
|
||||
This is line 88 of the test data.
|
||||
This is line 89 of the test data.
|
||||
This is line 90 of the test data.
|
||||
This is line 91 of the test data.
|
||||
This is line 92 of the test data.
|
||||
This is line 93 of the test data.
|
||||
This is line 94 of the test data.
|
||||
This is line 95 of the test data.
|
||||
This is line 96 of the test data.
|
||||
This is line 97 of the test data.
|
||||
This is line 98 of the test data.
|
||||
This is line 99 of the test data.
|
||||
This is line 100 of the test data.
|
||||
This is line 101 of the test data.
|
||||
This is line 102 of the test data.
|
||||
This is line 103 of the test data.
|
||||
This is line 104 of the test data.
|
||||
This is line 105 of the test data.
|
||||
This is line 106 of the test data.
|
||||
This is line 107 of the test data.
|
||||
This is line 108 of the test data.
|
||||
This is line 109 of the test data.
|
||||
This is line 110 of the test data.
|
||||
This is line 111 of the test data.
|
||||
This is line 112 of the test data.
|
||||
This is line 113 of the test data.
|
||||
This is line 114 of the test data.
|
||||
This is line 115 of the test data.
|
||||
This is line 116 of the test data.
|
||||
This is line 117 of the test data.
|
||||
This is line 118 of the test data.
|
||||
This is line 119 of the test data.
|
||||
This is line 120 of the test data.
|
||||
This is line 121 of the test data.
|
||||
This is line 122 of the test data.
|
||||
This is line 123 of the test data.
|
||||
This is line 124 of the test data.
|
||||
This is line 125 of the test data.
|
||||
This is line 126 of the test data.
|
||||
This is line 127 of the test data.
|
||||
This is line 128 of the test data.
|
||||
This is line 129 of the test data.
|
||||
This is line 130 of the test data.
|
||||
This is line 131 of the test data.
|
||||
This is line 132 of the test data.
|
||||
This is line 133 of the test data.
|
||||
This is line 134 of the test data.
|
||||
This is line 135 of the test data.
|
||||
This is line 136 of the test data.
|
||||
This is line 137 of the test data.
|
||||
This is line 138 of the test data.
|
||||
This is line 139 of the test data.
|
||||
This is line 140 of the test data.
|
||||
This is line 141 of the test data.
|
||||
This is line 142 of the test data.
|
||||
This is line 143 of the test data.
|
||||
This is line 144 of the test data.
|
||||
This is line 145 of the test data.
|
||||
This is line 146 of the test data.
|
||||
This is line 147 of the test data.
|
||||
This is line 148 of the test data.
|
||||
This is line 149 of the test data.
|
||||
@@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Testing ftp_nb_fget can handle large files incl. resume
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
if (2147483647 == PHP_INT_MAX) {
|
||||
die('skip ot supported on this system');
|
||||
}
|
||||
if (disk_free_space(__DIR__) < 10*1024*1024*1024) {
|
||||
die('not enough disk space');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
$ftp = ftp_connect('127.0.0.1', $port);
|
||||
ftp_login($ftp, 'user', 'pass');
|
||||
if (!$ftp) die("Couldn't connect to the server");
|
||||
|
||||
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
|
||||
touch($local_file);
|
||||
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
|
||||
$fp = fopen($local_file, 'r');
|
||||
fseek($fp, 5368709119);
|
||||
var_dump(fread($fp, 1));
|
||||
var_dump(filesize($local_file));
|
||||
fclose($fp);
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "X"
|
||||
int(5368709120)
|
||||
@@ -357,7 +357,24 @@ if ($pid) {
|
||||
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
|
||||
fputs($fs, "Bar\r\n");
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
break;
|
||||
case "fget_large":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
$transfer_type = $ascii? 'ASCII' : 'BINARY' ;
|
||||
if ($GLOBALS['rest_pos'] == '5368709119') {
|
||||
fputs($fs, "X");
|
||||
} else {
|
||||
fputs($fs, "Y");
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
case "mediumfile":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
for($i = 0; $i < 150; $i++){
|
||||
fputs($fs, "This is line $i of the test data.\n");
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
|
||||
default:
|
||||
fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
|
||||
break;
|
||||
@@ -393,11 +410,12 @@ if ($pid) {
|
||||
}elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
|
||||
fputs($s, "425 Error establishing connection\r\n");
|
||||
|
||||
}elseif (preg_match('/^REST \d+/', $buf, $matches)) {
|
||||
}elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
|
||||
$GLOBALS['rest_pos'] = $matches[1];
|
||||
fputs($s, "350 OK\r\n");
|
||||
}
|
||||
|
||||
else {
|
||||
}elseif (preg_match('/^SIZE largefile/', $buf)) {
|
||||
fputs($s, "213 5368709120\r\n");
|
||||
}else {
|
||||
fputs($s, "500 Syntax error, command unrecognized.\r\n");
|
||||
dump_and_exit($buf);
|
||||
}
|
||||
@@ -407,4 +425,4 @@ if ($pid) {
|
||||
}
|
||||
|
||||
fclose($socket);
|
||||
?>
|
||||
?>
|
||||
+1
-1
@@ -61,7 +61,7 @@
|
||||
|
||||
PHPAPI extern const char php_sig_gif[3];
|
||||
PHPAPI extern const char php_sig_jpg[3];
|
||||
PHPAPI extern const char php_sig_png[3];
|
||||
PHPAPI extern const char php_sig_png[8];
|
||||
|
||||
extern zend_module_entry gd_module_entry;
|
||||
#define phpext_gd_ptr &gd_module_entry
|
||||
|
||||
+1
-1
@@ -1069,7 +1069,7 @@ ZEND_FUNCTION(gmp_powm)
|
||||
zval **base_arg, **exp_arg, **mod_arg;
|
||||
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
|
||||
int use_ui = 0;
|
||||
int temp_base, temp_exp, temp_mod;
|
||||
int temp_base = 0, temp_exp = 0, temp_mod;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
|
||||
return;
|
||||
|
||||
+2
-2
@@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then
|
||||
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
|
||||
fi
|
||||
|
||||
if test -r "$IMAP_DIR/c-client/c-client.a"; then
|
||||
if test ! -r "$IMAP_DIR/c-client/libc-client.a" && test -r "$IMAP_DIR/c-client/c-client.a" ; then
|
||||
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
|
||||
elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
||||
elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
|
||||
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char
|
||||
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
|
||||
int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC)
|
||||
{
|
||||
UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL;
|
||||
UChar *uhaystack = NULL, *uneedle = NULL;
|
||||
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;
|
||||
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
|
||||
UBreakIterator* bi = NULL;
|
||||
|
||||
@@ -127,6 +127,9 @@ static char* getPreferredTag(char* gf_tag)
|
||||
int grOffset = 0;
|
||||
|
||||
grOffset = findOffset( LOC_GRANDFATHERED ,gf_tag);
|
||||
if(grOffset < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if( grOffset < LOC_PREFERRED_GRANDFATHERED_LEN ){
|
||||
/* return preferred tag */
|
||||
result = estrdup( LOC_PREFERRED_GRANDFATHERED[grOffset] );
|
||||
|
||||
@@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
|
||||
case URES_STRING:
|
||||
ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
|
||||
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
|
||||
INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0);
|
||||
INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
|
||||
break;
|
||||
|
||||
case URES_BINARY:
|
||||
|
||||
@@ -162,8 +162,8 @@ PHP_FUNCTION( resourcebundle_create )
|
||||
/* {{{ resourcebundle_array_fetch */
|
||||
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
|
||||
{
|
||||
int32_t meindex;
|
||||
char * mekey;
|
||||
int32_t meindex = 0;
|
||||
char * mekey = NULL;
|
||||
long mekeylen;
|
||||
zend_bool is_numeric = 0;
|
||||
char *pbuf;
|
||||
|
||||
@@ -2107,6 +2107,7 @@ PHP_FUNCTION(ldap_set_rebind_proc)
|
||||
/* unregister rebind procedure */
|
||||
if (ld->rebindproc != NULL) {
|
||||
zval_dtor(ld->rebindproc);
|
||||
FREE_ZVAL(ld->rebindproc);
|
||||
ld->rebindproc = NULL;
|
||||
ldap_set_rebind_proc(ld->link, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -217,14 +217,26 @@ array(2) {
|
||||
[1]=>
|
||||
resource(%d) of type (ldap result)
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
resource(%d) of type (ldap result)
|
||||
[1]=>
|
||||
resource(%d) of type (ldap result)
|
||||
}
|
||||
NULL
|
||||
NULL
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
array(1) {
|
||||
["count"]=>
|
||||
int(0)
|
||||
}
|
||||
===DONE===
|
||||
@@ -142,7 +142,7 @@ const struct mbfl_convert_vtbl vtbl_wchar_2022jp_kddi = {
|
||||
int
|
||||
mbfl_filt_conv_2022jp_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int c1, s, w, snd;
|
||||
int c1, s, w, snd = 0;
|
||||
|
||||
retry:
|
||||
switch (filter->status & 0xf) {
|
||||
|
||||
@@ -134,7 +134,7 @@ int
|
||||
mbfl_filt_conv_jis2004_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int k;
|
||||
int c1, c2, s, s1, s2, w = 0, w1;
|
||||
int c1, c2, s, s1 = 0, s2 = 0, w = 0, w1;
|
||||
|
||||
retry:
|
||||
switch (filter->status & 0xf) {
|
||||
|
||||
@@ -605,7 +605,7 @@ mbfilter_unicode2sjis_emoji_sb(int c, int *s1, mbfl_convert_filter *filter)
|
||||
int
|
||||
mbfl_filt_conv_sjis_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int c1, s, s1, s2, w;
|
||||
int c1, s, s1 = 0, s2 = 0, w;
|
||||
int snd = 0;
|
||||
|
||||
retry:
|
||||
|
||||
@@ -79,7 +79,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
|
||||
@@ -93,6 +93,17 @@ const struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
|
||||
|
||||
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
|
||||
|
||||
int mbfl_filt_put_invalid_char(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int w;
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* UTF-8 => wchar
|
||||
*/
|
||||
@@ -100,111 +111,104 @@ int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int s, c1, w = 0, flag = 0;
|
||||
|
||||
if (c < 0x80) {
|
||||
if (filter->status != 0) {
|
||||
w = (filter->cache & MBFL_WCSGROUP_MASK) | MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
}
|
||||
if (c >= 0) {
|
||||
retry:
|
||||
switch (filter->status & 0xff) {
|
||||
case 0x00:
|
||||
if (c < 0x80) {
|
||||
CK((*filter->output_function)(c, filter->data));
|
||||
}
|
||||
} else if (c < 0xc0) {
|
||||
int status = filter->status & 0xff;
|
||||
switch (status) {
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
s = filter->cache | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
if ((status == 0x10 && s >= 0x80) ||
|
||||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
|
||||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = filter->cache | ((c & 0x3f) << 6);
|
||||
c1 = (s >> 12) & 0xf;
|
||||
if ((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
filter->cache |= ((c & 0x3f) << 6);
|
||||
filter->status++;
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = filter->cache | ((c & 0x3f) << 12);
|
||||
c1 = (s >> 18) & 0x7;
|
||||
if ((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 > 0x0 && c1 < 0x4) ||
|
||||
(c1 == 0x4 && c < 0x90)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
|
||||
if (filter->status == 0x0) {
|
||||
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
|
||||
filter->status = 0x10;
|
||||
filter->cache = (c & 0x1f) << 6;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0x1f;
|
||||
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
|
||||
filter->status = 0x20;
|
||||
filter->cache = (c & 0xf) << 12;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0xf;
|
||||
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
|
||||
filter->status = 0x30;
|
||||
filter->cache = (c & 0x7) << 18;
|
||||
filter->cache = c & 0x7;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
mbfl_filt_put_invalid_char(c, filter);
|
||||
}
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
break;
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0xf;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0x7;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 == 0x4 && c < 0x90) ||
|
||||
(c1 > 0x0 && c1 != 0x4))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
filter->cache = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
filter->status = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter)
|
||||
{
|
||||
int status, cache;
|
||||
|
||||
status = filter->status;
|
||||
cache = filter->cache;
|
||||
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
|
||||
if (status != 0) {
|
||||
mbfl_filt_put_invalid_char(cache, filter);
|
||||
}
|
||||
|
||||
if (filter->flush_function != NULL) {
|
||||
(*filter->flush_function)(filter->data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* wchar => UTF-8
|
||||
*/
|
||||
|
||||
@@ -37,5 +37,6 @@ extern const struct mbfl_convert_vtbl vtbl_wchar_utf8;
|
||||
|
||||
int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter);
|
||||
int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter);
|
||||
int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
|
||||
|
||||
#endif /* MBFL_MBFILTER_UTF8_H */
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "mbfilter_sjis_mobile.h"
|
||||
|
||||
extern int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter);
|
||||
extern int mbfl_filt_conv_utf8_wchar_flush(mbfl_convert_filter *filter);
|
||||
|
||||
extern const unsigned char mblen_table_utf8[];
|
||||
|
||||
@@ -115,7 +116,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_docomo_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_docomo = {
|
||||
@@ -133,7 +134,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_a_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_a = {
|
||||
@@ -151,7 +152,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_kddi_b_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_kddi_b = {
|
||||
@@ -169,7 +170,7 @@ const struct mbfl_convert_vtbl vtbl_utf8_sb_wchar = {
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_utf8_mobile_wchar,
|
||||
mbfl_filt_conv_common_flush
|
||||
mbfl_filt_conv_utf8_wchar_flush
|
||||
};
|
||||
|
||||
const struct mbfl_convert_vtbl vtbl_wchar_utf8_sb = {
|
||||
@@ -191,119 +192,97 @@ int mbfl_filt_conv_utf8_mobile_wchar(int c, mbfl_convert_filter *filter)
|
||||
int s, w = 0, flag = 0;
|
||||
int s1 = 0, c1 = 0, snd = 0;
|
||||
|
||||
if (c < 0x80) {
|
||||
if (c >= 0) {
|
||||
retry:
|
||||
switch (filter->status & 0xff) {
|
||||
case 0x00:
|
||||
if (c < 0x80) {
|
||||
CK((*filter->output_function)(c, filter->data));
|
||||
}
|
||||
filter->status = 0;
|
||||
} else if (c < 0xc0) {
|
||||
int status = filter->status & 0xff;
|
||||
switch (status) {
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
s = filter->cache | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
if ((status == 0x10 && s >= 0x80) ||
|
||||
(status == 0x21 && s >= 0x800 && (s < 0xd800 || s > 0xdfff)) ||
|
||||
(status == 0x32 && s >= 0x10000 && s < 0x110000)) {
|
||||
|
||||
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
|
||||
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
|
||||
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
|
||||
}
|
||||
|
||||
if (snd > 0) {
|
||||
CK((*filter->output_function)(snd, filter->data));
|
||||
}
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = filter->cache | ((c & 0x3f) << 6);
|
||||
c1 = (s >> 12) & 0xf;
|
||||
if ((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
filter->cache |= ((c & 0x3f) << 6);
|
||||
filter->status++;
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = filter->cache | ((c & 0x3f) << 12);
|
||||
c1 = (s >> 18) & 0x7;
|
||||
if ((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 > 0x0 && c1 < 0x4) ||
|
||||
(c1 == 0x4 && c < 0x90)) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
w = s & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
} else if (c < 0xc2) { /* invalid: 0xc0,0xc1 */
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
} else if (c < 0xe0) { /* 2byte code first char: 0xc2-0xdf */
|
||||
if (filter->status == 0x0) {
|
||||
} else if (c >= 0xc2 && c <= 0xdf) { /* 2byte code first char: 0xc2-0xdf */
|
||||
filter->status = 0x10;
|
||||
filter->cache = (c & 0x1f) << 6;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf0) { /* 3byte code first char: 0xe0-0xef */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0x1f;
|
||||
} else if (c >= 0xe0 && c <= 0xef) { /* 3byte code first char: 0xe0-0xef */
|
||||
filter->status = 0x20;
|
||||
filter->cache = (c & 0xf) << 12;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
} else if (c < 0xf5) { /* 4byte code first char: 0xf0-0xf4 */
|
||||
if (filter->status == 0x0) {
|
||||
filter->cache = c & 0xf;
|
||||
} else if (c >= 0xf0 && c <= 0xf4) { /* 3byte code first char: 0xf0-0xf4 */
|
||||
filter->status = 0x30;
|
||||
filter->cache = (c & 0x7) << 18;
|
||||
filter->cache = c & 0x7;
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
mbfl_filt_put_invalid_char(c, filter);
|
||||
}
|
||||
} else {
|
||||
w = c & MBFL_WCSGROUP_MASK;
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
w |= MBFL_WCSGROUP_THROUGH;
|
||||
CK((*filter->output_function)(w, filter->data));
|
||||
break;
|
||||
case 0x10: /* 2byte code 2nd char: 0x80-0xbf */
|
||||
case 0x21: /* 3byte code 3rd char: 0x80-0xbf */
|
||||
case 0x32: /* 4byte code 4th char: 0x80-0xbf */
|
||||
filter->status = 0;
|
||||
filter->cache = 0;
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->cache = 0;
|
||||
|
||||
if (filter->from->no_encoding == mbfl_no_encoding_utf8_docomo &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_docomo2uni_pua, 4) > 0) {
|
||||
s = mbfilter_sjis_emoji_docomo2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_a &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua, 7) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_kddi_b &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_kddi2uni_pua_b, 8) > 0) {
|
||||
s = mbfilter_sjis_emoji_kddi2unicode(s1, &snd);
|
||||
} else if (filter->from->no_encoding == mbfl_no_encoding_utf8_sb &&
|
||||
mbfilter_conv_r_map_tbl(s, &s1, mbfl_sb2uni_pua, 6) > 0) {
|
||||
s = mbfilter_sjis_emoji_sb2unicode(s1, &snd);
|
||||
}
|
||||
|
||||
if (snd > 0) {
|
||||
CK((*filter->output_function)(snd, filter->data));
|
||||
}
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0xf;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0xa0) ||
|
||||
(c1 == 0xd && c < 0xa0) ||
|
||||
(c1 > 0x0 && c1 != 0xd))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x30: /* 4byte code 2nd char: 0:0x90-0xbf,1-3:0x80-0xbf,4:0x80-0x8f */
|
||||
s = (filter->cache<<6) | (c & 0x3f);
|
||||
c1 = filter->cache & 0x7;
|
||||
|
||||
if ((c >= 0x80 && c <= 0xbf) &&
|
||||
((c1 == 0x0 && c >= 0x90) ||
|
||||
(c1 == 0x4 && c < 0x90) ||
|
||||
(c1 > 0x0 && c1 != 0x4))) {
|
||||
filter->cache = s;
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
case 0x31: /* 4byte code 3rd char: 0x80-0xbf */
|
||||
if (c >= 0x80 && c <= 0xbf) {
|
||||
filter->cache = (filter->cache<<6) | (c & 0x3f);
|
||||
filter->status++;
|
||||
} else {
|
||||
mbfl_filt_put_invalid_char(filter->cache, filter);
|
||||
goto retry;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
filter->status = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return c;
|
||||
|
||||
@@ -985,7 +985,7 @@ mbfl_strpos(
|
||||
{
|
||||
int result;
|
||||
mbfl_string _haystack_u8, _needle_u8;
|
||||
const mbfl_string *haystack_u8, *needle_u8;
|
||||
const mbfl_string *haystack_u8, *needle_u8 = NULL;
|
||||
const unsigned char *u8_tbl;
|
||||
|
||||
if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) {
|
||||
|
||||
@@ -673,7 +673,7 @@ History
|
||||
2004/10/18: [impl] (thanks Imai Yasumasa)
|
||||
enclose #include <sys/types.h> by #ifndef __BORLANDC__.
|
||||
2004/10/18: [bug] (thanks Imai Yasumasa)
|
||||
memory acess violation in select_opt_exact_info().
|
||||
memory access violation in select_opt_exact_info().
|
||||
2004/09/25: [dist] fix doc/API and doc/API.ja.
|
||||
2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for
|
||||
the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #65045: mb_convert_encoding breaks well-formed character
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//declare(encoding = 'UTF-8');
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
|
||||
$expected = "\xEF\xBF\xBD"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
|
||||
|
||||
$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
|
||||
$expected2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xEF\xBF\xBD";
|
||||
|
||||
mb_substitute_character(0xFFFD);
|
||||
var_dump(
|
||||
$expected === htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8')),
|
||||
$expected2 === htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8')),
|
||||
$expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
|
||||
$expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
|
||||
);
|
||||
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -25,28 +25,28 @@ var_dump(chk_enc("\x31\x32\x33", 0));
|
||||
var_dump(chk_enc("\x41\x42\x43", 0));
|
||||
var_dump(chk_enc("\xc0\xb1\xc0\xb2\xc0\xb3", 6));
|
||||
var_dump(chk_enc("\xc1\x81\xc1\x82\xc1\x83", 6));
|
||||
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 6));
|
||||
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 6));
|
||||
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 8));
|
||||
var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 9));
|
||||
var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 12));
|
||||
var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 11));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x80\xb1\xf8\x80\x80\x80\xb2\xf8\x80\x80\x80\xb3", 15));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x81\x81\xf8\x80\x80\x81\x82\xf8\x80\x80\x81\x83", 15));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x80\xb1\xfc\x80\x80\x80\x80\xb2\xfc\x80\x80\x80\x80\xb3", 18));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x81\x81\xfc\x80\x80\x80\x81\x82\xfc\x80\x80\x80\x81\x83", 18));
|
||||
|
||||
var_dump(chk_enc("\xc2\xa2\xc2\xa3\xc2\xa5", 0));
|
||||
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 6));
|
||||
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 9));
|
||||
var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 9));
|
||||
var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 12));
|
||||
var_dump(chk_enc("\xf8\x80\x80\x82\xa2\xf8\x80\x80\x82\xa3\xf8\x80\x80\x82\xa5", 15));
|
||||
var_dump(chk_enc("\xfc\x80\x80\x80\x82\xa2\xfc\x80\x80\x80\x82\xa3\xfc\x80\x80\x80\x82\xa5", 18));
|
||||
|
||||
var_dump(chk_enc("\xc1\xbf", 2));
|
||||
var_dump(chk_enc("\xc2\x80", 0));
|
||||
var_dump(chk_enc("\xdf\xbf", 0));
|
||||
var_dump(chk_enc("\xe0\x9f\xff", 2));
|
||||
var_dump(chk_enc("\xe0\x9f\xff", 3));
|
||||
var_dump(chk_enc("\xe0\xa0\x80", 2));
|
||||
var_dump(chk_enc("\xef\xbf\xbf", 0));
|
||||
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 3));
|
||||
var_dump(chk_enc("\xf0\x8f\xbf\xbf", 4));
|
||||
var_dump(chk_enc("\xf0\x90\x80\x80", 0));
|
||||
var_dump(chk_enc("\xf7\xbf\xbf\xbf", 4));
|
||||
var_dump(chk_enc("\xf8\x87\xbf\xbf\xbf", 5));
|
||||
@@ -61,7 +61,7 @@ echo "UTF-8 and surrogates area\n";
|
||||
$out = '';
|
||||
$cnt = 0;
|
||||
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
|
||||
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 2);
|
||||
$s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
|
||||
if ($s === false) {
|
||||
$cnt++;
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@ mb_http_output()
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
//TODO: Add more encoding. Wrong paramter type test.
|
||||
//TODO: Add more encoding. Wrong parameter type test.
|
||||
//$debug = true;
|
||||
ini_set('include_path', dirname(__FILE__));
|
||||
include_once('common.inc');
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ PHP_ARG_WITH(mysql, for MySQL support,
|
||||
mysqlnd the MySQL native driver will be used])
|
||||
|
||||
PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
|
||||
[ --with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
|
||||
[ --with-mysql-sock[=SOCKPATH] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
|
||||
If unspecified, the default locations are searched], no, no)
|
||||
|
||||
if test -z "$PHP_ZLIB_DIR"; then
|
||||
|
||||
@@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_result)
|
||||
|
||||
/*
|
||||
johannes TODO:
|
||||
Do 2 zend_parse_paramters calls instead of type "z" and switch below
|
||||
Do 2 zend_parse_parameters calls instead of type "z" and switch below
|
||||
Q: String or long first?
|
||||
*/
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
|
||||
|
||||
@@ -166,7 +166,7 @@ mysqlnd.collect_memory_statistics=1
|
||||
mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
|
||||
mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
|
||||
|
||||
// real_data_* get incremeneted after mysqli_*fetch*()
|
||||
// real_data_* get incremented after mysqli_*fetch*()
|
||||
mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
|
||||
mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
|
||||
|
||||
|
||||
@@ -1142,6 +1142,7 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS
|
||||
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC)
|
||||
{
|
||||
php_socket_t this_fd;
|
||||
php_stream *stream = NULL;
|
||||
int cnt = 0;
|
||||
MYSQLND **p = conn_array;
|
||||
|
||||
@@ -1151,7 +1152,8 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
|
||||
* when casting. It is only used here so that the buffered data warning
|
||||
* is not displayed.
|
||||
* */
|
||||
if (SUCCESS == php_stream_cast((*p)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
stream = (*p)->data->net->stream;
|
||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
||||
|
||||
PHP_SAFE_FD_SET(this_fd, fds);
|
||||
@@ -1169,6 +1171,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
|
||||
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC)
|
||||
{
|
||||
php_socket_t this_fd;
|
||||
php_stream *stream = NULL;
|
||||
int ret = 0;
|
||||
zend_bool disproportion = FALSE;
|
||||
|
||||
@@ -1176,7 +1179,8 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
|
||||
MYSQLND **fwd = conn_array, **bckwd = conn_array;
|
||||
|
||||
while (*fwd) {
|
||||
if (SUCCESS == php_stream_cast((*fwd)->data->net->stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
stream = (*fwd)->data->net->stream;
|
||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
||||
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
|
||||
if (disproportion) {
|
||||
|
||||
@@ -758,7 +758,7 @@ MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum
|
||||
/*
|
||||
Switch to non-blocking mode and try to consume something from
|
||||
the line, if possible, then continue. This saves us from looking for
|
||||
the actuall place where out-of-order packets have been sent.
|
||||
the actual place where out-of-order packets have been sent.
|
||||
If someone is completely sure that everything is fine, he can switch it
|
||||
off.
|
||||
*/
|
||||
|
||||
+26
-11
@@ -370,18 +370,33 @@ PHP_ARG_WITH(iodbc,,
|
||||
|
||||
if test "$PHP_IODBC" != "no"; then
|
||||
AC_MSG_CHECKING(for iODBC support)
|
||||
if test "$PHP_IODBC" = "yes"; then
|
||||
PHP_IODBC=/usr/local
|
||||
if test -z "$PKG_CONFIG"; then
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
fi
|
||||
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
|
||||
ODBC_TYPE=iodbc
|
||||
ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
|
||||
ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
|
||||
ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
|
||||
PHP_EVAL_INCLINE($ODBC_INCLUDE)
|
||||
AC_DEFINE(HAVE_IODBC,1,[ ])
|
||||
AC_DEFINE(HAVE_ODBC2,1,[ ])
|
||||
AC_MSG_RESULT([$ext_output])
|
||||
else
|
||||
if test "$PHP_IODBC" = "yes"; then
|
||||
PHP_IODBC=/usr/local
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
|
||||
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
|
||||
ODBC_TYPE=iodbc
|
||||
ODBC_INCLUDE=-I$PHP_IODBC/include
|
||||
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
|
||||
ODBC_LIBS=-liodbc
|
||||
AC_DEFINE(HAVE_IODBC,1,[ ])
|
||||
AC_DEFINE(HAVE_ODBC2,1,[ ])
|
||||
AC_MSG_RESULT([$ext_output])
|
||||
fi
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
|
||||
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
|
||||
ODBC_TYPE=iodbc
|
||||
ODBC_INCLUDE=-I$PHP_IODBC/include
|
||||
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
|
||||
ODBC_LIBS=-liodbc
|
||||
AC_DEFINE(HAVE_IODBC,1,[ ])
|
||||
AC_DEFINE(HAVE_ODBC2,1,[ ])
|
||||
AC_MSG_RESULT([$ext_output])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ typedef struct odbc_connection {
|
||||
} odbc_connection;
|
||||
|
||||
typedef struct odbc_result_value {
|
||||
char name[32];
|
||||
char name[256];
|
||||
char *value;
|
||||
SQLLEN vallen;
|
||||
SQLLEN coltype;
|
||||
|
||||
+122
-47
@@ -561,6 +561,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
|
||||
|
||||
static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval **data;
|
||||
zval *subitem, *subentries;
|
||||
int i, j = -1, last = -1, obj_cnt = 0;
|
||||
char *sname;
|
||||
@@ -578,7 +579,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
|
||||
|
||||
for (i = 0; i < X509_NAME_entry_count(name); i++) {
|
||||
unsigned char *to_add;
|
||||
int to_add_len;
|
||||
int to_add_len = 0;
|
||||
|
||||
|
||||
ne = X509_NAME_get_entry(name, i);
|
||||
@@ -592,39 +593,27 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
|
||||
sname = (char *) OBJ_nid2ln(nid);
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(subentries);
|
||||
array_init(subentries);
|
||||
|
||||
last = -1;
|
||||
for (;;) {
|
||||
j = X509_NAME_get_index_by_OBJ(name, obj, last);
|
||||
if (j < 0) {
|
||||
if (last != -1) break;
|
||||
} else {
|
||||
obj_cnt++;
|
||||
ne = X509_NAME_get_entry(name, j);
|
||||
str = X509_NAME_ENTRY_get_data(ne);
|
||||
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
|
||||
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
|
||||
if (to_add_len != -1) {
|
||||
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
|
||||
}
|
||||
} else {
|
||||
to_add = ASN1_STRING_data(str);
|
||||
to_add_len = ASN1_STRING_length(str);
|
||||
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
|
||||
}
|
||||
}
|
||||
last = j;
|
||||
}
|
||||
i = last;
|
||||
|
||||
if (obj_cnt > 1) {
|
||||
add_assoc_zval_ex(subitem, sname, strlen(sname) + 1, subentries);
|
||||
str = X509_NAME_ENTRY_get_data(ne);
|
||||
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
|
||||
to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
|
||||
} else {
|
||||
zval_dtor(subentries);
|
||||
FREE_ZVAL(subentries);
|
||||
if (obj_cnt && str && to_add_len > -1) {
|
||||
to_add = ASN1_STRING_data(str);
|
||||
to_add_len = ASN1_STRING_length(str);
|
||||
}
|
||||
|
||||
if (to_add_len != -1) {
|
||||
if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
|
||||
if (Z_TYPE_PP(data) == IS_ARRAY) {
|
||||
subentries = *data;
|
||||
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
|
||||
} else if (Z_TYPE_PP(data) == IS_STRING) {
|
||||
MAKE_STD_ZVAL(subentries);
|
||||
array_init(subentries);
|
||||
add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
|
||||
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
|
||||
zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
|
||||
}
|
||||
} else {
|
||||
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
|
||||
}
|
||||
}
|
||||
@@ -1398,6 +1387,74 @@ PHP_FUNCTION(openssl_x509_check_private_key)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Special handling of subjectAltName, see CVE-2013-4073
|
||||
* Christian Heimes
|
||||
*/
|
||||
|
||||
static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension)
|
||||
{
|
||||
GENERAL_NAMES *names;
|
||||
const X509V3_EXT_METHOD *method = NULL;
|
||||
long i, length, num;
|
||||
const unsigned char *p;
|
||||
|
||||
method = X509V3_EXT_get(extension);
|
||||
if (method == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = extension->value->data;
|
||||
length = extension->value->length;
|
||||
if (method->it) {
|
||||
names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length,
|
||||
ASN1_ITEM_ptr(method->it)));
|
||||
} else {
|
||||
names = (GENERAL_NAMES*)(method->d2i(NULL, &p, length));
|
||||
}
|
||||
if (names == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
num = sk_GENERAL_NAME_num(names);
|
||||
for (i = 0; i < num; i++) {
|
||||
GENERAL_NAME *name;
|
||||
ASN1_STRING *as;
|
||||
name = sk_GENERAL_NAME_value(names, i);
|
||||
switch (name->type) {
|
||||
case GEN_EMAIL:
|
||||
BIO_puts(bio, "email:");
|
||||
as = name->d.rfc822Name;
|
||||
BIO_write(bio, ASN1_STRING_data(as),
|
||||
ASN1_STRING_length(as));
|
||||
break;
|
||||
case GEN_DNS:
|
||||
BIO_puts(bio, "DNS:");
|
||||
as = name->d.dNSName;
|
||||
BIO_write(bio, ASN1_STRING_data(as),
|
||||
ASN1_STRING_length(as));
|
||||
break;
|
||||
case GEN_URI:
|
||||
BIO_puts(bio, "URI:");
|
||||
as = name->d.uniformResourceIdentifier;
|
||||
BIO_write(bio, ASN1_STRING_data(as),
|
||||
ASN1_STRING_length(as));
|
||||
break;
|
||||
default:
|
||||
/* use builtin print for GEN_OTHERNAME, GEN_X400,
|
||||
* GEN_EDIPARTY, GEN_DIRNAME, GEN_IPADD and GEN_RID
|
||||
*/
|
||||
GENERAL_NAME_print(bio, name);
|
||||
}
|
||||
/* trailing ', ' except for last element */
|
||||
if (i < (num - 1)) {
|
||||
BIO_puts(bio, ", ");
|
||||
}
|
||||
}
|
||||
sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* {{{ proto array openssl_x509_parse(mixed x509 [, bool shortnames=true])
|
||||
Returns an array of the fields/values of the CERT */
|
||||
PHP_FUNCTION(openssl_x509_parse)
|
||||
@@ -1494,15 +1551,30 @@ PHP_FUNCTION(openssl_x509_parse)
|
||||
|
||||
|
||||
for (i = 0; i < X509_get_ext_count(cert); i++) {
|
||||
int nid;
|
||||
extension = X509_get_ext(cert, i);
|
||||
if (OBJ_obj2nid(X509_EXTENSION_get_object(extension)) != NID_undef) {
|
||||
nid = OBJ_obj2nid(X509_EXTENSION_get_object(extension));
|
||||
if (nid != NID_undef) {
|
||||
extname = (char *)OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(extension)));
|
||||
} else {
|
||||
OBJ_obj2txt(buf, sizeof(buf)-1, X509_EXTENSION_get_object(extension), 1);
|
||||
extname = buf;
|
||||
}
|
||||
bio_out = BIO_new(BIO_s_mem());
|
||||
if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
|
||||
if (nid == NID_subject_alt_name) {
|
||||
if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) {
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
|
||||
} else {
|
||||
zval_dtor(return_value);
|
||||
if (certresource == -1 && cert) {
|
||||
X509_free(cert);
|
||||
}
|
||||
BIO_free(bio_out);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
else if (X509V3_EXT_print(bio_out, extension, 0, 0)) {
|
||||
BIO_get_mem_ptr(bio_out, &bio_buf);
|
||||
add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1);
|
||||
} else {
|
||||
@@ -4541,9 +4613,6 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
|
||||
|
||||
GET_VER_OPT_STRING("local_cert", certfile);
|
||||
if (certfile) {
|
||||
X509 *cert = NULL;
|
||||
EVP_PKEY *key = NULL;
|
||||
SSL *tmpssl;
|
||||
char resolved_path_buff[MAXPATHLEN];
|
||||
const char * private_key = NULL;
|
||||
|
||||
@@ -4570,16 +4639,22 @@ SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{
|
||||
}
|
||||
}
|
||||
|
||||
tmpssl = SSL_new(ctx);
|
||||
cert = SSL_get_certificate(tmpssl);
|
||||
|
||||
if (cert) {
|
||||
key = X509_get_pubkey(cert);
|
||||
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
|
||||
EVP_PKEY_free(key);
|
||||
}
|
||||
SSL_free(tmpssl);
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10001001L
|
||||
do {
|
||||
/* Unnecessary as of OpenSSLv1.0.1 (will segfault if used with >= 10001001 ) */
|
||||
X509 *cert = NULL;
|
||||
EVP_PKEY *key = NULL;
|
||||
SSL *tmpssl = SSL_new(ctx);
|
||||
cert = SSL_get_certificate(tmpssl);
|
||||
|
||||
if (cert) {
|
||||
key = X509_get_pubkey(cert);
|
||||
EVP_PKEY_copy_parameters(key, SSL_get_privatekey(tmpssl));
|
||||
EVP_PKEY_free(key);
|
||||
}
|
||||
SSL_free(tmpssl);
|
||||
} while (0);
|
||||
#endif
|
||||
if (!SSL_CTX_check_private_key(ctx)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Private key does not match certificate!");
|
||||
}
|
||||
|
||||
Loaded 100 of 252 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user