mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 11:10:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7603abbc51 | ||
|
|
4ae24d9250 | ||
|
|
bf393c89d8 | ||
|
|
f251b16fcc | ||
|
|
5904e1e55e | ||
|
|
bef6df6a7e | ||
|
|
c3771929b7 | ||
|
|
7dce9533e7 | ||
|
|
8c3093d660 | ||
|
|
3592dce76d | ||
|
|
6922659b8b | ||
|
|
f44cd92cd2 | ||
|
|
dc87efa848 | ||
|
|
6787bfc37d | ||
|
|
bce433e422 | ||
|
|
e0e19a12be | ||
|
|
a6601cb692 |
No files matched your search
@@ -1,8 +1,6 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? May 2015, PHP 5.6.9
|
||||
|
||||
02 Apr 2015, PHP 5.6.8
|
||||
16 Apr 2015, PHP 5.6.8
|
||||
|
||||
- Core:
|
||||
. Fixed bug #66609 (php crashes with __get() and ++ operator in some cases).
|
||||
@@ -12,19 +10,31 @@ PHP NEWS
|
||||
. Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai)
|
||||
. Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM
|
||||
configuration options). (Anatol Belski)
|
||||
. Additional fix for bug #69152 (Type confusion vulnerability in
|
||||
exception::getTraceAsString). (Stas)
|
||||
. Fixed bug #69210 (serialize function return corrupted data when sleep has
|
||||
non-string values). (Juan Basso)
|
||||
. Fixed bug #69212 (Leaking VIA_HANDLER func when exception thrown in
|
||||
__call/... arg passing). (Nikita)
|
||||
. Fixed bug #69221 (Segmentation fault when using a generator in combination
|
||||
with an Iterator). (Nikita)
|
||||
. Fixed bug #69337 (php_stream_url_wrap_http_ex() type-confusion
|
||||
vulnerability). (Stas)
|
||||
. Fixed bug #69353 (Missing null byte checks for paths in various PHP
|
||||
extensions). (Stas)
|
||||
|
||||
- Apache2handler:
|
||||
. Fixed bug #69218 (potential remote code execution with apache 2.4
|
||||
apache2handler). (Gerrit Venema)
|
||||
|
||||
- cURL:
|
||||
. Implemented FR#69278 (HTTP2 support). (Masaki Kagaya)
|
||||
. Fixed bug #68739 (Missing break / control flow). (Laruence)
|
||||
. Fixed bug #69316 (Use-after-free in php_curl related to
|
||||
CURLOPT_FILE/_INFILE/_WRITEHEADER). (Laruence)
|
||||
|
||||
- Date:
|
||||
. Added DateTime::createFromImmutable(). (Trevor Suarez)
|
||||
. Fixed bug #69336 (Issues with "last day of <monthname>"). (Derick Rethans)
|
||||
|
||||
- Enchant:
|
||||
. Fixed bug #65406 (Enchant broker plugins are in the wrong place in windows
|
||||
@@ -33,6 +43,10 @@ PHP NEWS
|
||||
- Ereg:
|
||||
. Fixed bug #68740 (NULL Pointer Dereference). (Laruence)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68819 (Fileinfo on specific file causes spurious OOM and/or
|
||||
segfault). (Anatol Belski)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #69202: (FILTER_FLAG_STRIP_BACKTICK ignored unless other
|
||||
flags are used). (Jeff Welch)
|
||||
@@ -42,6 +56,7 @@ PHP NEWS
|
||||
- OPCache:
|
||||
. Fixed bug #69297 (function_exists strange behavior with OPCache on
|
||||
disabled function). (Laruence)
|
||||
. Fixed bug #69281 (opcache_is_script_cached no longer works). (danack)
|
||||
. Fixed bug #68677 (Use After Free). (CVE-2015-1351) (Laruence)
|
||||
|
||||
- OpenSSL
|
||||
@@ -60,6 +75,9 @@ PHP NEWS
|
||||
. Fixed bug #65467 (Call to undefined method cli_arg_typ_string). (Mike)
|
||||
. Fixed bug #67761 (Phar::mapPhar fails for Phars inside a path containing
|
||||
".tar"). (Mike)
|
||||
. Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar). (Stas)
|
||||
. Fixed bug #69441 (Buffer Overflow when parsing tar/zip/phar in
|
||||
phar_set_inode). (Stas)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #68741 (Null pointer dereference). (CVE-2015-1352) (Laruence)
|
||||
@@ -72,10 +90,11 @@ PHP NEWS
|
||||
. Fixed bug #69293 (NEW segfault when using SoapClient::__setSoapHeader
|
||||
(bisected, regression)). (Laruence)
|
||||
|
||||
- SQLITE:
|
||||
- Sqlite3:
|
||||
. Fixed bug #68760 (SQLITE segfaults if custom collator throws an exception).
|
||||
(Dan Ackroyd)
|
||||
. Fixed bug #69287 (Upgrade bundled libsqlite to 3.8.8.3). (Anatol)
|
||||
. Fixed bug #66550 (SQLite prepared statement use-after-free). (Sean Heelan)
|
||||
|
||||
19 Mar 2015, PHP 5.6.7
|
||||
|
||||
@@ -281,7 +300,7 @@ PHP NEWS
|
||||
interval). (Marc Bennewitz)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68799: Free called on unitialized pointer. (CVE-2015-0232)
|
||||
. Fixed bug #68799: Free called on uninitialized pointer. (CVE-2015-0232)
|
||||
(Stas)
|
||||
|
||||
- Fileinfo:
|
||||
|
||||
@@ -271,7 +271,6 @@ PHP 5.6 UPGRADE NOTES
|
||||
|
||||
- Datetime:
|
||||
Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
|
||||
Added DateTime::createFromImmutable() in 5.6.8.
|
||||
|
||||
- GMP:
|
||||
Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
|
||||
|
||||
@@ -587,10 +587,14 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if(Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
res = estrdup("");
|
||||
str = &res;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=9
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=8
|
||||
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`
|
||||
|
||||
|
||||
@@ -1346,6 +1346,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1411,6 +1412,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION");
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1489,6 +1491,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1566,6 +1569,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
length = CURL_READFUNC_ABORT;
|
||||
#endif
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
length = MIN((int) (size * nmemb), Z_STRLEN_P(retval_ptr));
|
||||
memcpy(data, Z_STRVAL_P(retval_ptr), length);
|
||||
@@ -1640,6 +1644,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function hdr_callback($ch, $data) {
|
||||
// close the stream, causing the FILE structure to be free()'d
|
||||
if($GLOBALS['f_file']) {
|
||||
fclose($GLOBALS['f_file']); $GLOBALS['f_file'] = 0;
|
||||
|
||||
// cause an allocation of approx the same size as a FILE structure, size varies a bit depending on platform/libc
|
||||
$FILE_size = (PHP_INT_SIZE == 4 ? 0x160 : 0x238);
|
||||
curl_setopt($ch, CURLOPT_COOKIE, str_repeat("a", $FILE_size - 1));
|
||||
}
|
||||
return strlen($data);
|
||||
}
|
||||
|
||||
include 'server.inc';
|
||||
$host = curl_cli_server_start();
|
||||
$temp_file = dirname(__FILE__) . '/body.tmp';
|
||||
$url = "{$host}/get.php?test=getpost";
|
||||
$ch = curl_init();
|
||||
$f_file = fopen($temp_file, "w") or die("failed to open file\n");
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, 10);
|
||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, "hdr_callback");
|
||||
curl_setopt($ch, CURLOPT_FILE, $f_file);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/body.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
array(1) {
|
||||
["test"]=>
|
||||
string(7) "getpost"
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
===DONE===
|
||||
+1
-34
@@ -185,10 +185,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, DateTimeImmutable)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -472,7 +468,6 @@ const zend_function_entry date_funcs_date[] = {
|
||||
PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(DateTime, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
|
||||
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
|
||||
@@ -2786,7 +2781,7 @@ PHP_METHOD(DateTimeImmutable, createFromMutable)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime_object, date_ce_date) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!", &datetime_object, date_ce_date) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2917,34 +2912,6 @@ PHP_METHOD(DateTime, __wakeup)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto DateTime::createFromImmutable(DateTimeImmutable object)
|
||||
Creates new DateTime object from an existing DateTimeImmutable object.
|
||||
*/
|
||||
PHP_METHOD(DateTime, createFromImmutable)
|
||||
{
|
||||
zval *datetimeimmutable_object = NULL;
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetimeimmutable_object, date_ce_immutable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
old_obj = (php_date_obj *) zend_object_store_get_object(datetimeimmutable_object TSRMLS_CC);
|
||||
new_obj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
if (old_obj->time->tz_abbr) {
|
||||
new_obj->time->tz_abbr = strdup(old_obj->time->tz_abbr);
|
||||
}
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Helper function used to add an associative array of warnings and errors to a zval */
|
||||
static void zval_from_error_container(zval *z, timelib_error_container *error)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,6 @@ PHP_FUNCTION(getdate);
|
||||
PHP_METHOD(DateTime, __construct);
|
||||
PHP_METHOD(DateTime, __wakeup);
|
||||
PHP_METHOD(DateTime, __set_state);
|
||||
PHP_METHOD(DateTime, createFromImmutable);
|
||||
PHP_FUNCTION(date_create);
|
||||
PHP_FUNCTION(date_create_immutable);
|
||||
PHP_FUNCTION(date_create_from_format);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Tests for DateTime::createFromImmutable.
|
||||
--INI--
|
||||
date.timezone=America/New_York
|
||||
--FILE--
|
||||
<?php
|
||||
$current = "2015-03-05 07:00:16";
|
||||
|
||||
$i = DateTime::createFromImmutable(date_create_immutable($current));
|
||||
var_dump($i);
|
||||
|
||||
$i = DateTime::createFromImmutable(date_create($current));
|
||||
var_dump($i);
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2015-03-05 07:00:16.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(16) "America/New_York"
|
||||
}
|
||||
|
||||
Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
|
||||
NULL
|
||||
@@ -27,7 +27,7 @@ object(ReflectionClass)#%d (1) {
|
||||
string(8) "DateTime"
|
||||
}
|
||||
..and get names of all its methods
|
||||
array(19) {
|
||||
array(18) {
|
||||
[0]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
@@ -52,109 +52,102 @@ array(19) {
|
||||
[3]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(19) "createFromImmutable"
|
||||
string(16) "createFromFormat"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[4]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(16) "createFromFormat"
|
||||
string(13) "getLastErrors"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[5]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(13) "getLastErrors"
|
||||
string(6) "format"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[6]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(6) "format"
|
||||
string(6) "modify"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[7]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(6) "modify"
|
||||
string(3) "add"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[8]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(3) "add"
|
||||
string(3) "sub"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[9]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(3) "sub"
|
||||
string(11) "getTimezone"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[10]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(11) "getTimezone"
|
||||
string(11) "setTimezone"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[11]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(11) "setTimezone"
|
||||
string(9) "getOffset"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[12]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(9) "getOffset"
|
||||
string(7) "setTime"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[13]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(7) "setTime"
|
||||
string(7) "setDate"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[14]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(7) "setDate"
|
||||
string(10) "setISODate"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[15]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(10) "setISODate"
|
||||
string(12) "setTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[16]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(12) "setTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[17]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(12) "getTimestamp"
|
||||
["class"]=>
|
||||
string(8) "DateTime"
|
||||
}
|
||||
[18]=>
|
||||
[17]=>
|
||||
&object(ReflectionMethod)#%d (2) {
|
||||
["name"]=>
|
||||
string(4) "diff"
|
||||
|
||||
+59
-55
@@ -187,10 +187,10 @@ ZEND_END_ARG_INFO();
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* class DOMDocument extends DOMNode
|
||||
* class DOMDocument extends DOMNode
|
||||
*
|
||||
* URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-i-Document
|
||||
* Since:
|
||||
* Since:
|
||||
*/
|
||||
|
||||
const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
@@ -235,10 +235,10 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-B63ED1A31
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -266,15 +266,15 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -285,10 +285,10 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -384,8 +384,8 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -443,7 +443,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ version string
|
||||
/* {{{ version string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
|
||||
Since: DOM Level 3
|
||||
@@ -501,8 +501,8 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-strictErrorChecking
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -541,7 +541,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ formatOutput boolean
|
||||
/* {{{ formatOutput boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -578,7 +578,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ validateOnParse boolean
|
||||
/* {{{ validateOnParse boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_validate_on_parse_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -615,7 +615,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resolveExternals boolean
|
||||
/* {{{ resolveExternals boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -652,7 +652,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -689,7 +689,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ recover boolean
|
||||
/* {{{ recover boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_recover_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -726,7 +726,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ substituteEntities boolean
|
||||
/* {{{ substituteEntities boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_substitue_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -763,8 +763,8 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -820,8 +820,8 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -836,7 +836,7 @@ int dom_document_config_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_element)
|
||||
{
|
||||
@@ -869,7 +869,7 @@ PHP_FUNCTION(dom_document_create_element)
|
||||
|
||||
/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
{
|
||||
@@ -896,7 +896,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
|
||||
/* {{{ proto DOMText dom_document_create_text_node(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_text_node)
|
||||
{
|
||||
@@ -924,7 +924,7 @@ PHP_FUNCTION(dom_document_create_text_node)
|
||||
|
||||
/* {{{ proto DOMComment dom_document_create_comment(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_comment)
|
||||
{
|
||||
@@ -952,7 +952,7 @@ PHP_FUNCTION(dom_document_create_comment)
|
||||
|
||||
/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
{
|
||||
@@ -980,7 +980,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
|
||||
/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
{
|
||||
@@ -1015,7 +1015,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
|
||||
/* {{{ proto DOMAttr dom_document_create_attribute(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_attribute)
|
||||
{
|
||||
@@ -1049,7 +1049,7 @@ PHP_FUNCTION(dom_document_create_attribute)
|
||||
|
||||
/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
{
|
||||
@@ -1082,7 +1082,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
|
||||
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||
{
|
||||
@@ -1116,7 +1116,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
xmlDocPtr docp;
|
||||
xmlNodePtr nodep, retnodep;
|
||||
dom_object *intern, *nodeobj;
|
||||
int ret;
|
||||
int ret;
|
||||
long recursive = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
|
||||
@@ -1127,7 +1127,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
|
||||
DOM_GET_OBJ(nodep, node, xmlNodePtr, nodeobj);
|
||||
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
|| nodep->type == XML_DOCUMENT_TYPE_NODE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot import: Node Type Not Supported");
|
||||
RETURN_FALSE;
|
||||
@@ -1217,7 +1217,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nodep->ns = nsptr;
|
||||
|
||||
DOM_RET_OBJ(nodep, &ret, intern);
|
||||
@@ -1519,11 +1519,15 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
|
||||
xmlInitParser();
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
char *file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
char *file_dest;
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
return NULL;
|
||||
}
|
||||
file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (file_dest) {
|
||||
ctxt = xmlCreateFileParserCtxt(file_dest);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ctxt = xmlCreateMemoryParserCtxt(source, source_len);
|
||||
}
|
||||
@@ -1845,7 +1849,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
zval *id;
|
||||
xmlDoc *docp;
|
||||
xmlNodePtr root;
|
||||
long flags = 0;
|
||||
long flags = 0;
|
||||
int err;
|
||||
dom_object *intern;
|
||||
|
||||
@@ -1858,7 +1862,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
err = xmlXIncludeProcessFlags(docp, flags);
|
||||
|
||||
/* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
but are not wanted in resulting document - must be done even if err as it could fail after
|
||||
having processed some xincludes */
|
||||
root = (xmlNodePtr) docp->children;
|
||||
@@ -1874,7 +1878,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1895,19 +1899,19 @@ PHP_FUNCTION(dom_document_validate)
|
||||
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
cvp = xmlNewValidCtxt();
|
||||
|
||||
|
||||
cvp->userData = NULL;
|
||||
cvp->error = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
cvp->warning = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
|
||||
|
||||
if (xmlValidateDocument(cvp, docp)) {
|
||||
RETVAL_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
xmlFreeValidCtxt(cvp);
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1948,7 +1952,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlSchemaNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2044,7 +2048,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2112,10 +2116,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
int source_len, refcount, ret;
|
||||
long options = 0;
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
|
||||
id = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &source, &source_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2148,7 +2152,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
htmlParseDocument(ctxt);
|
||||
newdoc = ctxt->myDoc;
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
|
||||
|
||||
if (!newdoc)
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -2270,13 +2274,13 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
buf = xmlBufferCreate();
|
||||
if (!buf) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (node->type == XML_DOCUMENT_FRAG_NODE) {
|
||||
int one_size;
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ assert.bail=true
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("");
|
||||
assert('$result === false');
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("text.html\0something");
|
||||
assert('$result === null');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
|
||||
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile() expects parameter 1 to be a valid path, string given %s
|
||||
@@ -508,6 +508,11 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
if (CHECK_NULL_PATH(buffer, buffer_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
@@ -1072,6 +1072,9 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
if (bytecnt > nbytes) {
|
||||
bytecnt = nbytes;
|
||||
}
|
||||
if (offset > bytecnt) {
|
||||
offset = bytecnt;
|
||||
}
|
||||
if (s == NULL) {
|
||||
ms->search.s_len = 0;
|
||||
ms->search.s = NULL;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 1
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = <<<HERE
|
||||
----a-----'''---------a---------------a--------a-----a-----a---------a-----as-------a----a--a-------------a--as-----s---------------a---------a---a--s-a-----a-----------asy---------a-----a-----------a----s--------a-------------a-------a--------a----s------------a-----a----------------a----s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a-----------------------a----a----s-------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a----------a----------------------a----a----s-------------a----------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n------a-------a-a-------a-----a----a---a-----a-----------------------a----a---a-----a------------------s-------a----a---a-----a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s------\r\n-------------------a-------a-a-------a-----a----a---a-------a------------------------a----a---a-----''--a-------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-------s-----a---a-------------------------a----a-------------a---a-------------------s-------a----a-------------a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a--------------------------------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a-----------------------a----a--------------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a----------a----------------------a----a--------------------a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a-----------------------a----a---a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a----------a----------------------a----a---a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-a-----------a-------a-a-------a-----a----a----a---s-----a-----------------------a----a----a---------a-----------------s-------a----a----a---------a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a--------a----a-----------------------a----a----------a----a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-------------a-------a-a-------a-----a----a--------s-----a---a-------------------------a----a--------------a---a-------------------s-------------a---------------a----a---a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a-----------Line truncated
|
||||
HERE;
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
|
||||
var_dump($type);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 2
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = '';
|
||||
|
||||
// These two in any order
|
||||
$string .= "\r\n";
|
||||
$string .= "''''";
|
||||
|
||||
// Total string length > 8192
|
||||
$string .= str_repeat(chr(rand(32, 127)), 8184);
|
||||
|
||||
// Ending in this string
|
||||
$string .= "say";
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
var_dump($type);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -19,6 +19,7 @@ echo "*** Testing finfo_file() : basic functionality ***\n";
|
||||
var_dump( finfo_file( $finfo, __FILE__) );
|
||||
var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
@@ -27,4 +28,7 @@ var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
string(22) "PHP script, ASCII text"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
Warning: finfo_file(): Invalid path in %s/finfo_file_basic.php on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
+4
-4
@@ -1432,7 +1432,7 @@ PHP_FUNCTION(imageloadfont)
|
||||
gdFontPtr font;
|
||||
php_stream *stream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_name) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2369,7 +2369,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
long ignore_warning;
|
||||
|
||||
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (width < 1 || height < 1) {
|
||||
@@ -2377,7 +2377,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4046,7 +4046,7 @@ PHP_FUNCTION(imagepsencodefont)
|
||||
char *enc, **enc_vector;
|
||||
int enc_len, *f_ind;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Testing that imageloadfont() breaks on non-string first parameter
|
||||
--CREDITS--
|
||||
Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
--SKIPIF--
|
||||
<?php
|
||||
<?php
|
||||
if (!extension_loaded("gd")) die("skip GD not present");
|
||||
?>
|
||||
--FILE--
|
||||
@@ -11,5 +11,5 @@ Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
var_dump( imageloadfont(array()) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imageloadfont() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
Warning: imageloadfont() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
+6
-1
@@ -143,6 +143,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
@@ -258,6 +259,10 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
if (!stream) {
|
||||
/* Stream will report errors opening file */
|
||||
@@ -462,7 +467,7 @@ PHP_FUNCTION(hash_update_file)
|
||||
char *filename, buf[1024];
|
||||
int filename_len, n;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
|
||||
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
|
||||
hash_hmac_file('foo', $file, $key, TRUE);
|
||||
|
||||
echo "\n-- Testing hash_hmac_file() function with bad path --\n";
|
||||
hash_hmac_file('crc32', $file.chr(0).$file, $key, TRUE);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
@@ -51,4 +54,8 @@ Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
|
||||
-- Testing hash_hmac_file() function with invalid hash algorithm --
|
||||
|
||||
Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d
|
||||
|
||||
-- Testing hash_hmac_file() function with bad path --
|
||||
|
||||
Warning: hash_hmac_file(): Invalid path in %s on line %d
|
||||
===Done===
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Test that script cached info is correct with validate_timestamps disabled
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.validate_timestamps=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(opcache_is_script_cached(__FILE__));
|
||||
var_dump(opcache_is_script_cached("nonexistent.php"));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -4,6 +4,7 @@ Test that script cached info is correct
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.validate_timestamps=1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
||||
@@ -324,14 +324,16 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)
|
||||
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1);
|
||||
if (persistent_script) {
|
||||
return !persistent_script->corrupted &&
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
|
||||
(!ZCG(accel_directives).validate_timestamps ||
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) {
|
||||
persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1);
|
||||
return persistent_script && !persistent_script->corrupted &&
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
|
||||
(!ZCG(accel_directives).validate_timestamps ||
|
||||
validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -3114,7 +3114,7 @@ PHP_FUNCTION(pg_trace)
|
||||
php_stream *stream;
|
||||
id = PGG(default_link);
|
||||
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "p|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+38
-41
@@ -598,52 +598,41 @@ int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len
|
||||
*
|
||||
* Meta-data is in this format:
|
||||
* [len32][data...]
|
||||
*
|
||||
*
|
||||
* data is the serialized zval
|
||||
*/
|
||||
int phar_parse_metadata(char **buffer, zval **metadata, int zip_metadata_len TSRMLS_DC) /* {{{ */
|
||||
int phar_parse_metadata(char **buffer, zval **metadata, php_uint32 zip_metadata_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
const unsigned char *p;
|
||||
php_uint32 buf_len;
|
||||
php_unserialize_data_t var_hash;
|
||||
|
||||
if (!zip_metadata_len) {
|
||||
PHAR_GET_32(*buffer, buf_len);
|
||||
} else {
|
||||
buf_len = zip_metadata_len;
|
||||
}
|
||||
|
||||
if (buf_len) {
|
||||
if (zip_metadata_len) {
|
||||
const unsigned char *p, *p_buff = estrndup(*buffer, zip_metadata_len);
|
||||
p = p_buff;
|
||||
ALLOC_ZVAL(*metadata);
|
||||
INIT_ZVAL(**metadata);
|
||||
p = (const unsigned char*) *buffer;
|
||||
PHP_VAR_UNSERIALIZE_INIT(var_hash);
|
||||
|
||||
if (!php_var_unserialize(metadata, &p, p + buf_len, &var_hash TSRMLS_CC)) {
|
||||
if (!php_var_unserialize(metadata, &p, p + zip_metadata_len, &var_hash TSRMLS_CC)) {
|
||||
efree(p_buff);
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
zval_ptr_dtor(metadata);
|
||||
*metadata = NULL;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
efree(p_buff);
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
|
||||
if (PHAR_G(persist)) {
|
||||
/* lazy init metadata */
|
||||
zval_ptr_dtor(metadata);
|
||||
*metadata = (zval *) pemalloc(buf_len, 1);
|
||||
memcpy(*metadata, *buffer, buf_len);
|
||||
*buffer += buf_len;
|
||||
*metadata = (zval *) pemalloc(zip_metadata_len, 1);
|
||||
memcpy(*metadata, *buffer, zip_metadata_len);
|
||||
return SUCCESS;
|
||||
}
|
||||
} else {
|
||||
*metadata = NULL;
|
||||
}
|
||||
|
||||
if (!zip_metadata_len) {
|
||||
*buffer += buf_len;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}}*/
|
||||
@@ -653,7 +642,7 @@ int phar_parse_metadata(char **buffer, zval **metadata, int zip_metadata_len TSR
|
||||
*
|
||||
* Parse a new one and add it to the cache, returning either SUCCESS or
|
||||
* FAILURE, and setting pphar to the pointer to the manifest entry
|
||||
*
|
||||
*
|
||||
* This is used by phar_open_from_filename to process the manifest, but can be called
|
||||
* directly.
|
||||
*/
|
||||
@@ -664,6 +653,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
phar_entry_info entry;
|
||||
php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags;
|
||||
php_uint16 manifest_ver;
|
||||
php_uint32 len;
|
||||
long offset;
|
||||
int sig_len, register_alias = 0, temp_alias = 0;
|
||||
char *signature = NULL;
|
||||
@@ -1029,16 +1019,21 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
mydata->is_persistent = PHAR_G(persist);
|
||||
|
||||
/* check whether we have meta data, zero check works regardless of byte order */
|
||||
PHAR_GET_32(buffer, len);
|
||||
if (mydata->is_persistent) {
|
||||
PHAR_GET_32(buffer, mydata->metadata_len);
|
||||
if (phar_parse_metadata(&buffer, &mydata->metadata, mydata->metadata_len TSRMLS_CC) == FAILURE) {
|
||||
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
|
||||
}
|
||||
} else {
|
||||
if (phar_parse_metadata(&buffer, &mydata->metadata, 0 TSRMLS_CC) == FAILURE) {
|
||||
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
|
||||
mydata->metadata_len = len;
|
||||
if(!len) {
|
||||
/* FIXME: not sure why this is needed but removing it breaks tests */
|
||||
PHAR_GET_32(buffer, len);
|
||||
}
|
||||
}
|
||||
if(len > endbuffer - buffer) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (trying to read past buffer end)");
|
||||
}
|
||||
if (phar_parse_metadata(&buffer, &mydata->metadata, len TSRMLS_CC) == FAILURE) {
|
||||
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
|
||||
}
|
||||
buffer += len;
|
||||
|
||||
/* set up our manifest */
|
||||
zend_hash_init(&mydata->manifest, manifest_count,
|
||||
@@ -1073,7 +1068,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
entry.manifest_pos = manifest_index;
|
||||
}
|
||||
|
||||
if (buffer + entry.filename_len + 20 > endbuffer) {
|
||||
if (entry.filename_len + 20 > endbuffer - buffer) {
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
||||
}
|
||||
|
||||
@@ -1109,19 +1104,21 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
|
||||
entry.flags |= PHAR_ENT_PERM_DEF_DIR;
|
||||
}
|
||||
|
||||
PHAR_GET_32(buffer, len);
|
||||
if (entry.is_persistent) {
|
||||
PHAR_GET_32(buffer, entry.metadata_len);
|
||||
if (!entry.metadata_len) buffer -= 4;
|
||||
if (phar_parse_metadata(&buffer, &entry.metadata, entry.metadata_len TSRMLS_CC) == FAILURE) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
|
||||
}
|
||||
entry.metadata_len = len;
|
||||
} else {
|
||||
if (phar_parse_metadata(&buffer, &entry.metadata, 0 TSRMLS_CC) == FAILURE) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
|
||||
}
|
||||
entry.metadata_len = 0;
|
||||
}
|
||||
if (len > endbuffer - buffer) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
|
||||
}
|
||||
if (phar_parse_metadata(&buffer, &entry.metadata, len TSRMLS_CC) == FAILURE) {
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
|
||||
}
|
||||
buffer += len;
|
||||
|
||||
entry.offset = entry.offset_abs = offset;
|
||||
offset += entry.compressed_filesize;
|
||||
@@ -2217,7 +2214,7 @@ last_time:
|
||||
|
||||
/**
|
||||
* Process a phar stream name, ensuring we can handle any of:
|
||||
*
|
||||
*
|
||||
* - whatever.phar
|
||||
* - whatever.phar.gz
|
||||
* - whatever.phar.bz2
|
||||
|
||||
@@ -536,10 +536,13 @@ static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char tmp[MAXPATHLEN];
|
||||
int tmp_len;
|
||||
size_t len;
|
||||
|
||||
tmp_len = entry->filename_len + entry->phar->fname_len;
|
||||
memcpy(tmp, entry->phar->fname, entry->phar->fname_len);
|
||||
memcpy(tmp + entry->phar->fname_len, entry->filename, entry->filename_len);
|
||||
tmp_len = MIN(MAXPATHLEN, entry->filename_len + entry->phar->fname_len);
|
||||
len = MIN(entry->phar->fname_len, tmp_len);
|
||||
memcpy(tmp, entry->phar->fname, len);
|
||||
len = MIN(tmp_len - len, entry->filename_len);
|
||||
memcpy(tmp + entry->phar->fname_len, entry->filename, len);
|
||||
entry->inode = (unsigned short)zend_get_hash_value(tmp, tmp_len);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -572,7 +575,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
|
||||
char *phar_find_in_include_path(char *file, int file_len, phar_archive_data **pphar TSRMLS_DC);
|
||||
char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC);
|
||||
phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
|
||||
int phar_parse_metadata(char **buffer, zval **metadata, int zip_metadata_len TSRMLS_DC);
|
||||
int phar_parse_metadata(char **buffer, zval **metadata, php_uint32 zip_metadata_len TSRMLS_DC);
|
||||
void destroy_phar_manifest_entry(void *pDest);
|
||||
int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC);
|
||||
php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC);
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #69324: Buffer Over-read in unserialize when parsing Phar
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("phar")) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$p = new Phar(dirname(__FILE__).'/bug69324.phar', 0);
|
||||
$meta=$p->getMetadata();
|
||||
var_dump($meta);
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
--EXPECTF--
|
||||
internal corruption of phar "%s" (truncated manifest entry)
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Phar: bug #69441: Buffer Overflow when parsing tar/zip/phar in phar_set_inode
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fname = dirname(__FILE__) . '/bug69441.phar';
|
||||
try {
|
||||
$r = new Phar($fname, 0);
|
||||
} catch(UnexpectedValueException $e) {
|
||||
echo $e;
|
||||
}
|
||||
?>
|
||||
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
exception 'UnexpectedValueException' with message 'phar error: corrupted central directory entry, no magic signature in zip-based phar "%s/bug69441.phar"' in %s/bug69441.php:%d
|
||||
Stack trace:
|
||||
#0 %s%ebug69441.php(%d): Phar->__construct('%s', 0)
|
||||
#1 {main}
|
||||
==DONE==
|
||||
+3
-3
@@ -2569,7 +2569,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
|
||||
}
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||
(Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
(Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
|
||||
}
|
||||
|
||||
@@ -2604,7 +2604,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
|
||||
}
|
||||
ret = FALSE;
|
||||
} else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||
(Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
(Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
|
||||
}
|
||||
zval_ptr_dtor(¶ms[4]);
|
||||
@@ -2649,7 +2649,7 @@ static void do_soap_call(zval* this_ptr,
|
||||
SOAP_CLIENT_BEGIN_CODE();
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||
(Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
(Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"));
|
||||
}
|
||||
|
||||
@@ -1287,6 +1287,8 @@ PHP_METHOD(sqlite3stmt, paramCount)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1305,6 +1307,8 @@ PHP_METHOD(sqlite3stmt, close)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1325,6 +1329,8 @@ PHP_METHOD(sqlite3stmt, reset)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1347,6 +1353,8 @@ PHP_METHOD(sqlite3stmt, clear)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1370,6 +1378,8 @@ PHP_METHOD(sqlite3stmt, readOnly)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -1439,6 +1449,8 @@ PHP_METHOD(sqlite3stmt, bindParam)
|
||||
zval *object = getThis();
|
||||
struct php_sqlite3_bound_param param = {0};
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
param.param_number = -1;
|
||||
param.type = SQLITE3_TEXT;
|
||||
@@ -1472,6 +1484,8 @@ PHP_METHOD(sqlite3stmt, bindValue)
|
||||
zval *object = getThis();
|
||||
struct php_sqlite3_bound_param param = {0};
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
param.param_number = -1;
|
||||
param.type = SQLITE3_TEXT;
|
||||
@@ -1509,6 +1523,8 @@ PHP_METHOD(sqlite3stmt, execute)
|
||||
|
||||
stmt_obj = (php_sqlite3_stmt *)zend_object_store_get_object(object TSRMLS_CC);
|
||||
|
||||
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3)
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #66550 (SQLite prepared statement use-after-free)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('sqlite3')) die('skip');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
|
||||
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
|
||||
|
||||
$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
|
||||
// Close the database connection and free the internal sqlite3_stmt object
|
||||
$db->close();
|
||||
// Access the sqlite3_stmt object via the php_sqlite3_stmt container
|
||||
$stmt->reset();
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
Warning: SQLite3Stmt::reset(): The SQLite3 object has not been correctly initialised in %s
|
||||
==DONE==
|
||||
@@ -19,7 +19,7 @@
|
||||
| Sara Golemon <pollita@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
#include "php.h"
|
||||
#include "php_globals.h"
|
||||
@@ -155,7 +155,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
|
||||
}
|
||||
|
||||
if (strncasecmp(resource->scheme, "http", sizeof("http")) && strncasecmp(resource->scheme, "https", sizeof("https"))) {
|
||||
if (!context ||
|
||||
if (!context ||
|
||||
php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == FAILURE ||
|
||||
Z_TYPE_PP(tmpzval) != IS_STRING ||
|
||||
Z_STRLEN_PP(tmpzval) <= 0) {
|
||||
@@ -171,7 +171,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
|
||||
transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval));
|
||||
} else {
|
||||
/* Normal http request (possibly with proxy) */
|
||||
|
||||
|
||||
if (strpbrk(mode, "awx+")) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections");
|
||||
php_url_free(resource);
|
||||
@@ -210,11 +210,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
|
||||
stream = php_stream_xport_create(transport_string, transport_len, options,
|
||||
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
|
||||
NULL, &timeout, context, &errstr, NULL);
|
||||
|
||||
|
||||
if (stream) {
|
||||
php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &timeout);
|
||||
}
|
||||
|
||||
|
||||
if (errstr) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr);
|
||||
efree(errstr);
|
||||
@@ -338,7 +338,7 @@ finish:
|
||||
/* avoid buffering issues while reading header */
|
||||
if (options & STREAM_WILL_CAST)
|
||||
chunk_size = php_stream_set_chunk_size(stream, 1);
|
||||
|
||||
|
||||
/* avoid problems with auto-detecting when reading the headers -> the headers
|
||||
* are always in canonical \r\n format */
|
||||
eol_detect = stream->flags & (PHP_STREAM_FLAG_DETECT_EOL | PHP_STREAM_FLAG_EOL_MAC);
|
||||
@@ -369,7 +369,7 @@ finish:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (context && php_stream_context_get_option(context, "http", "protocol_version", &tmpzval) == SUCCESS) {
|
||||
SEPARATE_ZVAL(tmpzval);
|
||||
convert_to_double_ex(tmpzval);
|
||||
@@ -428,7 +428,7 @@ finish:
|
||||
|
||||
if (context && php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS) {
|
||||
tmp = NULL;
|
||||
|
||||
|
||||
if (Z_TYPE_PP(tmpzval) == IS_ARRAY) {
|
||||
HashPosition pos;
|
||||
zval **tmpheader = NULL;
|
||||
@@ -468,33 +468,33 @@ finish:
|
||||
strip_header(user_headers, tmp, "content-type:");
|
||||
}
|
||||
|
||||
if ((s = strstr(tmp, "user-agent:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
if ((s = strstr(tmp, "user-agent:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_USER_AGENT;
|
||||
}
|
||||
if ((s = strstr(tmp, "host:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_HOST;
|
||||
}
|
||||
if ((s = strstr(tmp, "from:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_FROM;
|
||||
}
|
||||
if ((s = strstr(tmp, "authorization:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_AUTH;
|
||||
}
|
||||
if ((s = strstr(tmp, "content-length:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_CONTENT_LENGTH;
|
||||
}
|
||||
if ((s = strstr(tmp, "content-type:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
have_header |= HTTP_HEADER_TYPE;
|
||||
}
|
||||
@@ -505,10 +505,10 @@ finish:
|
||||
}
|
||||
/* remove Proxy-Authorization header */
|
||||
if (use_proxy && use_ssl && (s = strstr(tmp, "proxy-authorization:")) &&
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
(s == tmp || *(s-1) == '\r' || *(s-1) == '\n' ||
|
||||
*(s-1) == '\t' || *(s-1) == ' ')) {
|
||||
char *p = s + sizeof("proxy-authorization:") - 1;
|
||||
|
||||
|
||||
while (s > tmp && (*(s-1) == ' ' || *(s-1) == '\t')) s--;
|
||||
while (*p != 0 && *p != '\r' && *p != '\n') p++;
|
||||
while (*p == '\r' || *p == '\n') p++;
|
||||
@@ -547,7 +547,7 @@ finish:
|
||||
}
|
||||
|
||||
tmp = (char*)php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL);
|
||||
|
||||
|
||||
if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) {
|
||||
php_stream_write(stream, scratch, strlen(scratch));
|
||||
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
|
||||
@@ -565,7 +565,7 @@ finish:
|
||||
|
||||
/* Send Host: header so name-based virtual hosts work */
|
||||
if ((have_header & HTTP_HEADER_HOST) == 0) {
|
||||
if ((use_ssl && resource->port != 443 && resource->port != 0) ||
|
||||
if ((use_ssl && resource->port != 443 && resource->port != 0) ||
|
||||
(!use_ssl && resource->port != 80 && resource->port != 0)) {
|
||||
if (snprintf(scratch, scratch_len, "Host: %s:%i\r\n", resource->host, resource->port) > 0)
|
||||
php_stream_write(stream, scratch, strlen(scratch));
|
||||
@@ -586,7 +586,7 @@ finish:
|
||||
php_stream_write_string(stream, "Connection: close\r\n");
|
||||
}
|
||||
|
||||
if (context &&
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "user_agent", &ua_zval) == SUCCESS &&
|
||||
Z_TYPE_PP(ua_zval) == IS_STRING) {
|
||||
ua_str = Z_STRVAL_PP(ua_zval);
|
||||
@@ -598,9 +598,9 @@ finish:
|
||||
#define _UA_HEADER "User-Agent: %s\r\n"
|
||||
char *ua;
|
||||
size_t ua_len;
|
||||
|
||||
|
||||
ua_len = sizeof(_UA_HEADER) + strlen(ua_str);
|
||||
|
||||
|
||||
/* ensure the header is only sent if user_agent is not blank */
|
||||
if (ua_len > sizeof(_UA_HEADER)) {
|
||||
ua = emalloc(ua_len + 1);
|
||||
@@ -614,7 +614,7 @@ finish:
|
||||
if (ua) {
|
||||
efree(ua);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (user_headers) {
|
||||
@@ -672,8 +672,12 @@ finish:
|
||||
|
||||
{
|
||||
zval **rh;
|
||||
zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &rh);
|
||||
if(zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &rh) != SUCCESS || Z_TYPE_PP(rh) != IS_ARRAY) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed, http_response_header overwritten");
|
||||
goto out;
|
||||
}
|
||||
response_header = *rh;
|
||||
Z_ADDREF_P(response_header);
|
||||
}
|
||||
|
||||
if (!php_stream_eof(stream)) {
|
||||
@@ -729,9 +733,9 @@ finish:
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed, unexpected end of socket!");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* read past HTTP headers */
|
||||
|
||||
|
||||
http_header_line = emalloc(HTTP_HEADER_BLOCK_SIZE);
|
||||
|
||||
while (!body && !php_stream_eof(stream)) {
|
||||
@@ -761,7 +765,7 @@ finish:
|
||||
follow_location = Z_LVAL_PP(tmpzval);
|
||||
} else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) {
|
||||
/* we shouldn't redirect automatically
|
||||
if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307)
|
||||
if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307)
|
||||
see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1
|
||||
RFC 7238 defines 308: http://tools.ietf.org/html/rfc7238 */
|
||||
follow_location = 0;
|
||||
@@ -801,7 +805,7 @@ finish:
|
||||
MAKE_STD_ZVAL(http_header);
|
||||
|
||||
ZVAL_STRINGL(http_header, http_header_line, http_header_line_length, 1);
|
||||
|
||||
|
||||
zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL);
|
||||
}
|
||||
} else {
|
||||
@@ -826,10 +830,10 @@ finish:
|
||||
char loc_path[HTTP_HEADER_BLOCK_SIZE];
|
||||
|
||||
*new_path='\0';
|
||||
if (strlen(location)<8 || (strncasecmp(location, "http://", sizeof("http://")-1) &&
|
||||
strncasecmp(location, "https://", sizeof("https://")-1) &&
|
||||
strncasecmp(location, "ftp://", sizeof("ftp://")-1) &&
|
||||
strncasecmp(location, "ftps://", sizeof("ftps://")-1)))
|
||||
if (strlen(location)<8 || (strncasecmp(location, "http://", sizeof("http://")-1) &&
|
||||
strncasecmp(location, "https://", sizeof("https://")-1) &&
|
||||
strncasecmp(location, "ftp://", sizeof("ftp://")-1) &&
|
||||
strncasecmp(location, "ftps://", sizeof("ftps://")-1)))
|
||||
{
|
||||
if (*location != '/') {
|
||||
if (*(location+1) != '\0' && resource->path) {
|
||||
@@ -843,7 +847,7 @@ finish:
|
||||
*s = '/';
|
||||
}
|
||||
}
|
||||
s[1] = '\0';
|
||||
s[1] = '\0';
|
||||
if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') {
|
||||
snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location);
|
||||
} else {
|
||||
@@ -916,18 +920,21 @@ out:
|
||||
|
||||
if (stream) {
|
||||
if (header_init) {
|
||||
zval_add_ref(&response_header);
|
||||
stream->wrapperdata = response_header;
|
||||
} else {
|
||||
if(response_header) {
|
||||
Z_DELREF_P(response_header);
|
||||
}
|
||||
}
|
||||
php_stream_notify_progress_init(context, 0, file_size);
|
||||
|
||||
|
||||
/* Restore original chunk size now that we're done with headers */
|
||||
if (options & STREAM_WILL_CAST)
|
||||
php_stream_set_chunk_size(stream, chunk_size);
|
||||
|
||||
/* restore the users auto-detect-line-endings setting */
|
||||
stream->flags |= eol_detect;
|
||||
|
||||
|
||||
/* as far as streams are concerned, we are now at the start of
|
||||
* the stream */
|
||||
stream->position = 0;
|
||||
@@ -938,8 +945,13 @@ out:
|
||||
if (transfer_encoding) {
|
||||
php_stream_filter_append(&stream->readfilters, transfer_encoding);
|
||||
}
|
||||
} else if (transfer_encoding) {
|
||||
php_stream_filter_free(transfer_encoding TSRMLS_CC);
|
||||
} else {
|
||||
if(response_header) {
|
||||
Z_DELREF_P(response_header);
|
||||
}
|
||||
if (transfer_encoding) {
|
||||
php_stream_filter_free(transfer_encoding TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ PHP_FUNCTION(readlink)
|
||||
char buff[MAXPATHLEN];
|
||||
int ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link, &link_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1548,7 +1548,7 @@ PHP_FUNCTION(stream_resolve_include_path)
|
||||
char *filename, *resolved_path;
|
||||
int filename_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ bool(false)
|
||||
Warning: readlink(): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d
|
||||
Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: readlink(): %s in %s on line %d
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Bug #69337 (Stream context leaks when http request fails)
|
||||
--SKIPIF--
|
||||
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:22345'); ?>
|
||||
--INI--
|
||||
allow_url_fopen=1
|
||||
allow_url_include=1
|
||||
--FILE--
|
||||
<?php
|
||||
require 'server.inc';
|
||||
|
||||
function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max)
|
||||
{
|
||||
if($notification_code == STREAM_NOTIFY_REDIRECTED) {
|
||||
// $http_response_header is now a string, but will be used as an array
|
||||
// by php_stream_url_wrap_http_ex() later on
|
||||
$GLOBALS['http_response_header'] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\0\0\0\0";
|
||||
}
|
||||
}
|
||||
|
||||
$ctx = stream_context_create();
|
||||
stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));
|
||||
|
||||
$responses = array(
|
||||
"data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n",
|
||||
"data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
|
||||
);
|
||||
|
||||
$pid = http_server("tcp://127.0.0.1:22345", $responses, $output);
|
||||
|
||||
$f = file_get_contents('http://127.0.0.1:22345/', 0, $ctx);
|
||||
|
||||
http_server_kill($pid);
|
||||
var_dump($f);
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
string(26) "HTTP/1.0 404 Not Found
|
||||
|
||||
"
|
||||
==DONE==
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #69152: Type Confusion Infoleak Vulnerability in unserialize()
|
||||
--FILE--
|
||||
<?php
|
||||
$x = unserialize('O:9:"exception":1:{s:16:"'."\0".'Exception'."\0".'trace";s:4:"ryat";}');
|
||||
echo $x;
|
||||
$x = unserialize('O:4:"test":1:{s:27:"__PHP_Incomplete_Class_Name";R:1;}');
|
||||
$x->test();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
exception 'Exception' in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
|
||||
Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
|
||||
@@ -1738,7 +1738,7 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ proto resource xmlwriter_open_uri(resource xmlwriter, string source)
|
||||
/* {{{ proto resource xmlwriter_open_uri(string source)
|
||||
Create new xmlwriter using source uri for output */
|
||||
static PHP_FUNCTION(xmlwriter_open_uri)
|
||||
{
|
||||
@@ -1759,7 +1759,7 @@ static PHP_FUNCTION(xmlwriter_open_uri)
|
||||
void *ioctx;
|
||||
#endif
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &source, &source_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--TEST--
|
||||
Test gzopen() function : usage variation
|
||||
Test gzopen() function : usage variation
|
||||
--SKIPIF--
|
||||
<?php
|
||||
<?php
|
||||
if (!extension_loaded("zlib")) {
|
||||
print "skip - zlib extension not loaded";
|
||||
}
|
||||
print "skip - zlib extension not loaded";
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
|
||||
* Description: Open a .gz-file and return a .gz-file pointer
|
||||
* Description: Open a .gz-file and return a .gz-file pointer
|
||||
* Source code: ext/zlib/zlib.c
|
||||
* Alias to functions:
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing gzopen() : usage variation ***\n";
|
||||
@@ -102,9 +102,9 @@ $inputs = array(
|
||||
|
||||
// unset data
|
||||
'unset var' => @$unset_var,
|
||||
|
||||
|
||||
// resource variable
|
||||
'resource' => $fp
|
||||
'resource' => $fp
|
||||
);
|
||||
|
||||
// loop through each element of the array for filename
|
||||
@@ -158,19 +158,19 @@ Error: 2 - gzopen(0.5): failed to open stream: No such file or directory, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--empty array--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--int indexed array--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--associative array--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--nested arrays--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d)
|
||||
NULL
|
||||
|
||||
--uppercase NULL--
|
||||
@@ -210,7 +210,7 @@ Error: 2 - gzopen(Class A object): failed to open stream: No such file or direct
|
||||
bool(false)
|
||||
|
||||
--instance of classWithoutToString--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, object given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, object given, %s(%d)
|
||||
NULL
|
||||
|
||||
--undefined var--
|
||||
@@ -222,7 +222,7 @@ Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
|
||||
bool(false)
|
||||
|
||||
--resource--
|
||||
Error: 2 - gzopen() expects parameter 1 to be string, resource given, %s(%d)
|
||||
Error: 2 - gzopen() expects parameter 1 to be a valid path, resource given, %s(%d)
|
||||
NULL
|
||||
===DONE===
|
||||
|
||||
@@ -29,15 +29,15 @@ foreach ( $variation as $var ) {
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
|
||||
Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
|
||||
Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
===DONE===
|
||||
@@ -45,5 +45,5 @@ foreach ( $variation as $var ) {
|
||||
--EXPECTF--
|
||||
Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
|
||||
bool(false)
|
||||
Error: 2 - readgzfile() expects parameter 1 to be string, object given, %s(%d)
|
||||
NULL
|
||||
Error: 2 - readgzfile() expects parameter 1 to be a valid path, object given, %s(%d)
|
||||
NULL
|
||||
+2
-2
@@ -593,7 +593,7 @@ static PHP_FUNCTION(gzopen)
|
||||
php_stream *stream;
|
||||
long use_include_path = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ static PHP_FUNCTION(readgzfile)
|
||||
int size;
|
||||
long use_include_path = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 6
|
||||
#define PHP_RELEASE_VERSION 9
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.6.9-dev"
|
||||
#define PHP_VERSION_ID 50609
|
||||
#define PHP_RELEASE_VERSION 8
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.6.8"
|
||||
#define PHP_VERSION_ID 50608
|
||||
@@ -688,6 +688,7 @@ zend_first_try {
|
||||
} zend_end_try();
|
||||
}
|
||||
apr_brigade_cleanup(brigade);
|
||||
apr_pool_cleanup_run(r->pool, (void *)&SG(server_context), php_server_context_cleanup);
|
||||
} else {
|
||||
ctx->r = parent_req;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user