Compare commits

..
20 Commits
Author SHA1 Message Date
Xinchen Hui 9d582eba74 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed arginfo

(cherry picked from commit e4af29b0b7)
2016-07-20 14:17:28 +02:00
Anatol Belski 729121df81 regenerate date parser with re2c 0.13.5
(cherry picked from commit 90c26fb6b1)
2016-07-20 14:10:20 +02:00
Derick Rethans 3b40ee2924 Merge branch 'PHP-5.6' into PHP-7.0
(cherry picked from commit 1dafa806a9)
2016-07-20 14:10:06 +02:00
Derick Rethans 59df5f31d4 Merge branch 'PHP-5.6' into PHP-7.0
(cherry picked from commit 7759d6b0db)
2016-07-20 14:09:52 +02:00
Anatol Belski c9b49bc94b update UPGRADING 2016-07-19 20:33:23 +02:00
Anatol Belski 78cde3d8dc set versions 2016-07-19 18:56:38 +02:00
Anatol Belski 24367afdf3 update NEWS 2016-07-19 18:55:51 +02:00
Pierre Joye bf2633542d #72482, Ilegal write/read access caused by gdImageAALine overflow
(cherry picked from commit b25009fc2c)
2016-07-19 18:38:58 +02:00
Pierre Joye fcb85af809 fix #72494, improve input color check and prevent issues when old gd are used, done before gd call
(cherry picked from commit 1d69028d2f)
2016-07-19 18:38:35 +02:00
Anatol Belski 114d5a3f48 fix test portability and expectation
The test images for #72603 and #72618 are broken, that seems to be
the cause of different test output. Seems also to be platform dependent,
so it's not reliable to depend on the exact error output.

(cherry picked from commit bd1919504b)
2016-07-19 18:07:53 +02:00
Stanislav Malyshev 39aafd71f1 Fix for bug #72513
This is applicable to 7 as well, but was somehow missing from the merge.

(cherry picked from commit 374ae8e9da)
2016-07-19 17:26:14 +02:00
Pierre Joye cc06543112 improve fix #72558, free contribRow as well
(cherry picked from commit 48e76abadd)
2016-07-19 16:46:41 +02:00
Pierre Joye 522253bc9b improve fix #72558, while (u>=0) with unsigned int will always be true
(cherry picked from commit df09515089)
2016-07-19 16:46:25 +02:00
Stanislav Malyshev c3a095af10 Fix memory leak
(cherry picked from commit 47d6ea6332)
2016-07-19 16:46:07 +02:00
Stanislav Malyshev 676f082836 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix #72519, possible OOB using imagegif
  fix #72512, invalid read or write for palette image when invalid transparent index is used
  Apparently some envs miss SIZE_MAX
  Fix tests
  Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment
  Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t
  Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c
  Fix for bug #72558, Integer overflow error within _gdContributionsAlloc()
  Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE
  Fix bug #72562 - destroy var_hash properly
  Fix bug #72533 (locale_accept_from_http out-of-bounds access)
  Fix fir bug #72520
  Fix for bug #72513
  Fix for bug #72513
  CS fix and comments with bug ID
  Fix for HTTP_PROXY issue.
  5.6.24RC1
  add tests for bug #72512
  Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access
  Fixed bug #72479 - same as #72434

Conflicts:
	Zend/zend_virtual_cwd.c
	ext/bz2/bz2.c
	ext/exif/exif.c
	ext/session/session.c
	ext/snmp/snmp.c
	ext/standard/basic_functions.c
	main/SAPI.c
	main/php_variables.c

(cherry picked from commit b00f8f2a5b)
2016-07-19 16:42:37 +02:00
Stanislav Malyshev 1b6e8e5d74 Partial fix for bug #72613 - do not allow reading past error read
(cherry picked from commit 5faa15c4ce)
2016-07-19 15:57:51 +02:00
Pierre Joye 5b48472ec3 fix #72512, invalid read or write for palette image when invalid transparent index is used
(cherry picked from commit 0fbcff1b35)
2016-07-19 15:55:20 +02:00
Stanislav Malyshev 62da85d35d Fix bug #72551 and bug #72552 - check before converting size_t->int
(cherry picked from commit 3810e7b362)
2016-07-19 15:51:34 +02:00
Stanislav Malyshev 159403f795 Fix bug #72541 - size_t overflow lead to heap corruption
(cherry picked from commit 2ca8d85dd4)
2016-07-19 15:51:04 +02:00
Pierre Joye 55f7df2617 fix #72519, possible OOB using imagegif
(cherry picked from commit 2fbce5f51f)
2016-07-19 15:48:57 +02:00
165 changed files with 14207 additions and 59893 deletions

No files matched your search

+1 -173
View File
@@ -1,173 +1,5 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
18 Aug 2016 PHP 7.0.10
- Core:
. Fixed bug #72629 (Caught exception assignment to variables ignores
references). (Laruence)
. Fixed bug #72594 (Calling an earlier instance of an included anonymous
class fatals). (Laruence)
. Fixed bug #72581 (previous property undefined in Exception after
deserialization). (Laruence)
. Fixed bug #72496 (Cannot declare public method with signature incompatible
with parent private method). (Pedro Magalhães)
. Fixed bug #72024 (microtime() leaks memory). (maroszek at gmx dot net)
. Fixed bug #71911 (Unable to set --enable-debug on building extensions by
phpize on Windows). (Yuji Uchiyama)
. Fixed bug causing ClosedGeneratorException being thrown into the calling
code instead of the Generator yielding from. (Bob)
. Implemented FR #72614 (Support "nmake test" on building extensions by
phpize). (Yuji Uchiyama)
. Fixed bug #72641 (phpize (on Windows) ignores PHP_PREFIX).
(Yuji Uchiyama)
. Fixed potential segfault in object storage freeing in shutdown sequence.
(Bob)
. Fixed bug #72663 (Create an Unexpected Object and Don't Invoke
__wakeup() in Deserialization). (Stas)
. Fixed bug #72681 (PHP Session Data Injection Vulnerability). (Stas)
. Fixed bug #72683 (getmxrr broken). (Anatol)
. Fixed bug #72742 (memory allocator fails to realloc small block to large
one). (Stas)
- Bz2:
. Fixed bug #72837 (integer overflow in bzdecompress caused heap
corruption). (Stas)
- Calendar:
. Fixed bug #67976 (cal_days_month() fails for final month of the French
calendar). (cmb)
. Fixed bug #71894 (AddressSanitizer: global-buffer-overflow in
zif_cal_from_jd). (cmb)
- COM:
. Fixed bug #72569 (DOTNET/COM array parameters broke in PHP7). (Anatol)
- CURL:
. Fixed bug #71709 (curl_setopt segfault with empty CURLOPT_HTTPHEADER).
(Pierrick)
. Fixed bug #71929 (CURLINFO_CERTINFO data parsing error). (Pierrick)
. Fixed bug #72674 (Heap overflow in curl_escape). (Stas)
- DOM:
. Fixed bug #66502 (DOM document dangling reference). (Sean Heelan, cmb)
- EXIF:
. Fixed bug #72735 (Samsung picture thumb not read (zero size)). (Kalle, Remi)
. Fixed bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF). (Stas)
- Filter:
. Fixed bug #71745 (FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8
range). (bugs dot php dot net at majkl578 dot cz)
- FPM:
. Fixed bug #72575 (using --allow-to-run-as-root should ignore missing user).
(gooh)
- GD:
. Fixed bug #72596 (imagetypes function won't advertise WEBP support). (cmb)
. Fixed bug #72604 (imagearc() ignores thickness for full arcs). (cmb)
. Fixed bug #70315 (500 Server Error but page is fully rendered). (cmb)
. Fixed bug #43828 (broken transparency of imagearc for truecolor in
blendingmode). (cmb)
. Fixed bug #66555 (Always false condition in ext/gd/libgd/gdkanji.c). (cmb)
. Fixed bug #68712 (suspicious if-else statements). (cmb)
. Fixed bug #72697 (select_colors write out-of-bounds). (Stas)
. Fixed bug #72730 (imagegammacorrect allows arbitrary write access). (Stas)
- Intl:
. Fixed bug #72639 (Segfault when instantiating class that extends
IntlCalendar and adds a property). (Laruence)
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
names). (cmb)
- mbstring:
. Fixed bug #72691 (mb_ereg_search raises a warning if a match zero-width).
(cmb)
. Fixed bug #72693 (mb_ereg_search increments search position when a match
zero-width). (cmb)
. Fixed bug #72694 (mb_ereg_search_setpos does not accept a string's last
position). (cmb)
. Fixed bug #72710 (`mb_ereg` causes buffer overflow on regexp compile error).
(ju1ius)
- Mcrypt:
. Fixed bug #72782 (Heap Overflow due to integer overflows). (Stas)
- Opcache:
. Fixed bug #72590 (Opcache restart with kill_all_lockers does not work).
(Keyur)
- PCRE:
. Fixed bug #72688 (preg_match missing group names in matches). (cmb)
- PDO_pgsql:
. Fixed bug #70313 (PDO statement fails to throw exception). (Matteo)
- Reflection:
. Fixed bug #72222 (ReflectionClass::export doesn't handle array constants).
(Nikita Nefedov)
- SimpleXML:
. Fixed bug #72588 (Using global var doesn't work while accessing SimpleXML
element). (Laruence)
- SNMP:
. Fixed bug #72708 (php_snmp_parse_oid integer overflow in memory
allocation). (djodjo at gmail dot com)
- SPL:
. Fixed bug #55701 (GlobIterator throws LogicException). (Valentin VĂLCIU)
. Fixed bug #72646 (SplFileObject::getCsvControl does not return the escape
character). (cmb)
. Fixed bug #72684 (AppendIterator segfault with closed generator). (Pierrick)
- SQLite3:
. Fixed bug #72668 (Spurious warning when exception is thrown in user defined
function). (Laruence)
. Fixed bug #72571 (SQLite3::bindValue, SQLite3::bindParam crash). (Laruence)
. Implemented FR #72653 (SQLite should allow opening with empty filename).
(cmb)
. Updated to SQLite3 3.13.0. (cmb)
- Standard:
. Fixed bug #72622 (array_walk + array_replace_recursive create references
from nothing). (Laruence)
. Fixed bug #72152 (base64_decode $strict fails to detect null byte).
(Lauri Kenttä)
. Fixed bug #72263 (base64_decode skips a character after padding in strict
mode). (Lauri Kenttä)
. Fixed bug #72264 (base64_decode $strict fails with whitespace between
padding). (Lauri Kenttä)
. Fixed bug #72330 (CSV fields incorrectly split if escape char followed by
UTF chars). (cmb)
- Streams:
. Fixed bug #41021 (Problems with the ftps wrapper). (vhuk)
. Fixed bug #54431 (opendir() does not work with ftps:// wrapper). (vhuk)
. Fixed bug #72667 (opendir() with ftp:// attempts to open data stream for
non-existent directories). (vhuk)
. Fixed bug #72771 (ftps:// wrapper is vulnerable to protocol downgrade
attack). (Stas)
- XMLRPC:
. Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing
array elements). (Laruence)
- Wddx:
. Fixed bug #72564 (boolean always deserialized as "true") (Remi)
. Fixed bug #72142 (WDDX Packet Injection Vulnerability in
wddx_serialize_value()). (Taoguang Chen)
. Fixed bug #72749 (wddx_deserialize allows illegal memory access) (Stas)
. Fixed bug #72750 (wddx_deserialize null dereference). (Stas)
. Fixed bug #72790 (wddx_deserialize null dereference with invalid xml).
(Stas)
. Fixed bug #72799 (wddx_deserialize null dereference in
php_wddx_pop_element). (Stas)
- Zip:
. Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd).
(Laruence)
21 Jul 2016 PHP 7.0.9
- Core:
@@ -191,10 +23,6 @@ PHP NEWS
- Curl:
. Fixed bug #72541 (size_t overflow lead to heap corruption). (Stas)
- Date:
. Fixed bug #66836 (DateTime::createFromFormat 'U' with pre 1970 dates fails
parsing). (derick)
- Exif:
. Fixed bug #72603 (Out of bound read in exif_process_IFD_in_MAKERNOTE).
(Stas)
@@ -1396,7 +1224,7 @@ PHP NEWS
- ODBC:
. Fixed bug #69975 (PHP segfaults when accessing nvarchar(max) defined
columns). (CVE-2015-8879) (cmb)
columns). (cmb)
- Opcache:
. Fixed bug #70656 (require() statement broken after opcache_reset() or a
-8
View File
@@ -442,8 +442,6 @@ Other
- Curl:
. Removed support for disabling the CURLOPT_SAFE_UPLOAD option. All curl file
uploads must use the curl_file / CURLFile APIs.
. curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
as a string (PHP >= 5.6.25)
- Date:
. Removed $is_dst parameter from mktime() and gmmktime().
@@ -746,8 +744,6 @@ out, that the corresponding SDK isn't available anymore.
. ZLIB_FINISH
- GD
. IMG_WEBP (>= 7.0.10)
. T1Lib support removed, thus lifting the optional dependency on T1Lib, the
following is therefore not available anymore:
@@ -823,7 +819,3 @@ out, that the corresponding SDK isn't available anymore.
of aditional information with internal functions. In PHP-5 it was possible
to use zend_function.op_array.reserved[] even for internal functions, but
now we don't allocate extra space.
- CURL
. curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
as a string (PHP >= 7.0.10)
-43
View File
@@ -1,43 +0,0 @@
--TEST--
Bug #72496 (declare public method with signature incompatible with parent private method should not throw a warning)
--FILE--
<?php
class Foo
{
private function getFoo()
{
return 'Foo';
}
private function getBar()
{
return 'Bar';
}
private function getBaz()
{
return 'Baz';
}
}
class Bar extends Foo
{
public function getFoo($extraArgument)
{
return $extraArgument;
}
protected function getBar($extraArgument)
{
return $extraArgument;
}
private function getBaz($extraArgument)
{
return $extraArgument;
}
}
echo "OK\n";
--EXPECT--
OK
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #72581 (previous property undefined in Exception after deserialization)
--FILE--
<?php
$e = new Exception('aaa', 200);
$a = serialize($e);
$b = unserialize($a);
var_dump($b->__toString());
?>
--EXPECTF--
string(%s) "Exception: aaa in %sbug72581.php:%d
Stack trace:
#0 {main}"
-33
View File
@@ -1,33 +0,0 @@
--TEST--
Bug #72594 (Calling an earlier instance of an included anonymous class fatals)
--INI--
opcache.enable=0
--FILE--
<?php
if (isset($runtime)) {
return new class {
public $bar;
public function bing($foo = null) {
if ($foo) $foo->bing();
}
};
}
$runtime = 1;
$oldFoo = require(__FILE__);
$newFoo = require(__FILE__);
var_dump(get_class_methods($oldFoo));
var_dump(get_object_vars($oldFoo));
$newFoo->bing($oldFoo);
?>
--EXPECTF--
array(1) {
[0]=>
string(4) "bing"
}
array(1) {
["bar"]=>
NULL
}
+28
View File
@@ -0,0 +1,28 @@
--TEST--
call_user_func() should error on reference arguments
--FILE--
<?php
namespace Foo;
function bar(&$ref) {
$ref = 24;
}
$x = 42;
$ref =& $x;
\call_user_func('Foo\bar', $x);
var_dump($x);
$y = 42;
$ref =& $y;
call_user_func('Foo\bar', $y);
var_dump($y);
?>
--EXPECTF--
Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
int(42)
Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
int(42)
@@ -40,10 +40,11 @@ Stack trace:
#2 %s(%d): Generator->next()
#3 {main}
Generator 1
Caught exception!
ClosedGeneratorException: Generator yielded from aborted, no return value available in %s:%d
Fatal error: Uncaught ClosedGeneratorException: Generator yielded from aborted, no return value available in %s:%d
Stack trace:
#0 [internal function]: gen(Object(Generator))
#1 %s(%d): Generator->current()
#2 {main}
NULL
thrown in %s on line %d
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #72629 (Caught exception assignment to variables ignores references)
--FILE--
<?php
$var = null;
$e = &$var;
try {
throw new Exception;
} catch (Exception $e) { }
var_dump($var === $e);
--EXPECT--
bool(true)
+2 -2
View File
@@ -3100,13 +3100,13 @@ get_function_via_handler:
if (retval) {
if (fcc->calling_scope && !call_via_handler) {
if (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT) {
if (!fcc->object && (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT)) {
if (error) {
zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
retval = 0;
} else {
zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
retval = 0;
return 0;
}
} else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
int severity;
+12 -12
View File
@@ -1548,21 +1548,21 @@ static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size, si
ZEND_MM_CHECK(chunk->heap == heap, "zend_mm_heap corrupted");
if (info & ZEND_MM_IS_SRUN) {
int old_bin_num = ZEND_MM_SRUN_BIN_NUM(info);
int old_bin_num, bin_num;
old_bin_num = ZEND_MM_SRUN_BIN_NUM(info);
old_size = bin_data_size[old_bin_num];
if (size <= ZEND_MM_MAX_SMALL_SIZE) {
int bin_num = ZEND_MM_SMALL_SIZE_TO_BIN(size);
if (old_bin_num == bin_num) {
bin_num = ZEND_MM_SMALL_SIZE_TO_BIN(size);
if (old_bin_num == bin_num) {
#if ZEND_DEBUG
dbg = zend_mm_get_debug_info(heap, ptr);
dbg->size = real_size;
dbg->filename = __zend_filename;
dbg->orig_filename = __zend_orig_filename;
dbg->lineno = __zend_lineno;
dbg->orig_lineno = __zend_orig_lineno;
dbg = zend_mm_get_debug_info(heap, ptr);
dbg->size = real_size;
dbg->filename = __zend_filename;
dbg->orig_filename = __zend_orig_filename;
dbg->lineno = __zend_lineno;
dbg->orig_lineno = __zend_orig_lineno;
#endif
return ptr;
}
return ptr;
}
} else /* if (info & ZEND_MM_IS_LARGE_RUN) */ {
ZEND_MM_CHECK(ZEND_MM_ALIGNED_OFFSET(page_offset, ZEND_MM_PAGE_SIZE) == 0, "zend_mm_heap corrupted");
+3 -10
View File
@@ -5283,7 +5283,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
opline = get_next_op(CG(active_op_array));
zend_make_var_result(&declare_node, opline);
/* TODO.AST drop this */
// TODO.AST drop this
GET_NODE(&FC(implementing_class), opline->result);
opline->op2_type = IS_CONST;
@@ -5299,15 +5299,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
opline->op1_type = IS_UNUSED;
if (!zend_hash_exists(CG(class_table), lcname)) {
zend_hash_add_ptr(CG(class_table), lcname, ce);
} else {
/* this anonymous class has been included */
zval zv;
ZVAL_PTR(&zv, ce);
destroy_zend_class(&zv);
return;
}
zend_hash_update_ptr(CG(class_table), lcname, ce);
} else {
zend_string *key;
@@ -5594,6 +5586,7 @@ void zend_compile_group_use(zend_ast *ast) /* {{{ */
}
/* }}} */
void zend_compile_const_decl(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
+2 -3
View File
@@ -291,8 +291,9 @@ ZEND_METHOD(exception, __construct)
/* {{{ proto Exception::__wakeup()
Exception unserialize checks */
#define CHECK_EXC_TYPE(name, type) \
ZVAL_UNDEF(&value); \
pvalue = zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &value); \
if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \
if(Z_TYPE_P(pvalue) != IS_UNDEF && Z_TYPE_P(pvalue) != type) { \
zval tmp; \
ZVAL_STRINGL(&tmp, name, sizeof(name) - 1); \
Z_OBJ_HANDLER_P(object, unset_property)(object, &tmp, NULL); \
@@ -567,7 +568,6 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
smart_str_appends(str, "Object(");
smart_str_appends(str, ZSTR_VAL(class_name));
smart_str_appends(str, "), ");
zend_string_release(class_name);
break;
}
}
@@ -1071,7 +1071,6 @@ ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception) /* {{{ */
if (!exception_ce || !instanceof_function(exception_ce, zend_ce_throwable)) {
zend_throw_error(NULL, "Cannot throw objects that do not implement Throwable");
zval_ptr_dtor(exception);
return;
}
zend_throw_exception_internal(exception);
+1 -4
View File
@@ -2444,12 +2444,9 @@ static void cleanup_unfinished_calls(zend_execute_data *execute_data, uint32_t o
if (UNEXPECTED(opline->opcode == ZEND_INIT_FCALL ||
opline->opcode == ZEND_INIT_FCALL_BY_NAME ||
opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME ||
opline->opcode == ZEND_INIT_DYNAMIC_CALL ||
opline->opcode == ZEND_INIT_USER_CALL ||
opline->opcode == ZEND_INIT_METHOD_CALL ||
opline->opcode == ZEND_INIT_STATIC_METHOD_CALL ||
opline->opcode == ZEND_NEW)) {
opline->opcode == ZEND_INIT_STATIC_METHOD_CALL)) {
ZEND_ASSERT(op_num);
opline--;
}
-1
View File
@@ -1097,7 +1097,6 @@ ZEND_API int zend_gc_collect_cycles(void)
if (EG(objects_store).object_buckets &&
IS_OBJ_VALID(EG(objects_store).object_buckets[obj->handle])) {
EG(objects_store).object_buckets[obj->handle] = SET_OBJ_INVALID(obj);
GC_TYPE(obj) = IS_NULL;
if (!(GC_FLAGS(obj) & IS_OBJ_FREE_CALLED)) {
GC_FLAGS(obj) |= IS_OBJ_FREE_CALLED;
-10
View File
@@ -521,16 +521,6 @@ ZEND_API zend_generator *zend_generator_update_current(zend_generator *generator
zend_throw_exception(zend_ce_ClosedGeneratorException, "Generator yielded from aborted, no return value available", 0);
EG(current_execute_data) = original_execute_data;
if (!((old_root ? old_root : generator)->flags & ZEND_GENERATOR_CURRENTLY_RUNNING)) {
leaf->node.ptr.root = root;
root->node.parent = NULL;
if (old_root) {
OBJ_RELEASE(&old_root->std);
}
zend_generator_resume(leaf);
return leaf->node.ptr.root; /* this may be updated during zend_generator_resume! */
}
} else {
zval_ptr_dtor(&root->value);
ZVAL_COPY(&root->value, &root->node.parent->value);
+2 -2
View File
@@ -268,8 +268,8 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
return 1;
}
/* If the prototype method is private do not enforce a signature */
if (proto->common.fn_flags & ZEND_ACC_PRIVATE) {
/* If both methods are private do not enforce a signature */
if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
return 1;
}
+21 -38
View File
@@ -2312,7 +2312,6 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
UNEXPECTED(!Z_ISREF_P(EX_VAR(opline->op1.var)))) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
FREE_UNFETCHED_OP1();
FREE_OP2_VAR_PTR();
HANDLE_EXCEPTION();
}
@@ -4154,7 +4153,6 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
USE_OPLINE
zend_class_entry *ce, *catch_ce;
zend_object *exception;
zval *ex;
SAVE_OPLINE();
/* Check whether an exception has been thrown, if not, jump over code */
@@ -4189,12 +4187,8 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
}
exception = EG(exception);
ex = EX_VAR(opline->op2.var);
if (UNEXPECTED(Z_ISREF_P(ex))) {
ex = Z_REFVAL_P(ex);
}
zval_ptr_dtor(ex);
ZVAL_OBJ(ex, EG(exception));
zval_ptr_dtor(EX_VAR(opline->op2.var));
ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception));
if (UNEXPECTED(EG(exception) != exception)) {
GC_REFCOUNT(EG(exception))++;
HANDLE_EXCEPTION();
@@ -4660,32 +4654,27 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY)
arg = GET_OP1_ZVAL_PTR(BP_VAR_R);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
if (Z_ISREF_P(arg) &&
!(EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
@@ -5455,10 +5444,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY)
}
FREE_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != NULL) {
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
}
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
zval *return_value = NULL;
@@ -7479,14 +7464,12 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
zend_generator_yield_from(generator, new_gen);
}
} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
if (RETURN_VALUE_USED(opline)) {
+39 -78
View File
@@ -3637,10 +3637,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN
}
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != NULL) {
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
}
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
zval *return_value = NULL;
@@ -4135,14 +4131,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
zend_generator_yield_from(generator, new_gen);
}
} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
if (RETURN_VALUE_USED(opline)) {
@@ -9553,7 +9547,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZE
USE_OPLINE
zend_class_entry *ce, *catch_ce;
zend_object *exception;
zval *ex;
SAVE_OPLINE();
/* Check whether an exception has been thrown, if not, jump over code */
@@ -9588,12 +9581,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZE
}
exception = EG(exception);
ex = EX_VAR(opline->op2.var);
if (UNEXPECTED(Z_ISREF_P(ex))) {
ex = Z_REFVAL_P(ex);
}
zval_ptr_dtor(ex);
ZVAL_OBJ(ex, EG(exception));
zval_ptr_dtor(EX_VAR(opline->op2.var));
ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception));
if (UNEXPECTED(EG(exception) != exception)) {
GC_REFCOUNT(EG(exception))++;
HANDLE_EXCEPTION();
@@ -12544,14 +12533,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
zend_generator_yield_from(generator, new_gen);
}
} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
if (RETURN_VALUE_USED(opline)) {
@@ -15371,32 +15358,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN
arg = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
if (Z_ISREF_P(arg) &&
!(EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
@@ -16372,14 +16354,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
zend_generator_yield_from(generator, new_gen);
}
} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
if (RETURN_VALUE_USED(opline)) {
@@ -18514,7 +18494,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLE
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
UNEXPECTED(!Z_ISREF_P(EX_VAR(opline->op1.var)))) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
HANDLE_EXCEPTION();
}
@@ -20801,7 +20780,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
UNEXPECTED(!Z_ISREF_P(EX_VAR(opline->op1.var)))) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
@@ -28997,31 +28975,26 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND
arg = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(!Z_ISREF_P(arg))) {
if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
opline->op2.num,
EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
EX(call)->func->common.scope ? "::" : "",
ZSTR_VAL(EX(call)->func->common.function_name));
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_OBJ(EX(call)->This)) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
}
ZVAL_UNDEF(param);
EX(call)->func = (zend_function*)&zend_pass_function;
EX(call)->called_scope = NULL;
Z_OBJ(EX(call)->This) = NULL;
ZEND_SET_CALL_INFO(EX(call), ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
if (Z_ISREF_P(arg) &&
!(EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
@@ -29325,10 +29298,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE
}
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != NULL) {
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
}
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
zval *return_value = NULL;
@@ -29823,14 +29792,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
zend_generator_yield_from(generator, new_gen);
}
} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
zval_ptr_dtor(val);
HANDLE_EXCEPTION();
} else {
if (RETURN_VALUE_USED(opline)) {
@@ -33630,7 +33597,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT) &&
UNEXPECTED(!Z_ISREF_P(EX_VAR(opline->op1.var)))) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
HANDLE_EXCEPTION();
}
@@ -37046,7 +37012,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
UNEXPECTED(!Z_ISREF_P(EX_VAR(opline->op1.var)))) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
HANDLE_EXCEPTION();
}
if (IS_CV == IS_VAR &&
@@ -40865,10 +40830,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA
}
zval_ptr_dtor_nogc(free_op1);
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != NULL) {
destroy_op_array(new_op_array);
efree_size(new_op_array, sizeof(zend_op_array));
}
HANDLE_EXCEPTION();
} else if (EXPECTED(new_op_array != NULL)) {
zval *return_value = NULL;
+1 -1
View File
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=0
PHP_RELEASE_VERSION=10
PHP_RELEASE_VERSION=9
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`
+4 -14
View File
@@ -594,26 +594,16 @@ static PHP_FUNCTION(bzdecompress)
/* compression is better then 2:1, need to allocate more memory */
bzs.avail_out = source_len;
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
if (size > SIZE_MAX) {
/* no reason to continue if we're going to drop it anyway */
break;
}
dest = safe_erealloc(dest, 1, bzs.avail_out+1, (size_t) size );
bzs.next_out = dest + size;
}
if (error == BZ_STREAM_END || error == BZ_OK) {
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
if (size > SIZE_MAX) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Decompressed size too big, max is %zd", SIZE_MAX);
efree(dest);
RETVAL_LONG(BZ_MEM_ERROR);
} else {
dest = safe_erealloc(dest, 1, (size_t) size, 1);
dest[size] = '\0';
RETVAL_STRINGL(dest, (size_t) size);
efree(dest);
}
dest = safe_erealloc(dest, 1, (size_t) size, 1);
dest[size] = '\0';
RETVAL_STRINGL(dest, (int) size);
efree(dest);
} else { /* real error */
efree(dest);
RETVAL_LONG(error);
+7 -17
View File
@@ -357,10 +357,6 @@ PHP_FUNCTION(cal_days_in_month)
}
else {
sdn_next = calendar->to_jd(year + 1, 1, 1);
if (cal == CAL_FRENCH && sdn_next == 0) {
/* The French calendar ends on 0014-13-05. */
sdn_next = 2380953;
}
}
}
@@ -418,21 +414,15 @@ PHP_FUNCTION(cal_from_jd)
add_assoc_long(return_value, "year", year);
/* day of week */
if (cal != CAL_JEWISH || year > 0) {
dow = DayOfWeek(jd);
add_assoc_long(return_value, "dow", dow);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]);
add_assoc_string(return_value, "dayname", DayNameLong[dow]);
} else {
add_assoc_null(return_value, "dow");
add_assoc_string(return_value, "abbrevdayname", "");
add_assoc_string(return_value, "dayname", "");
}
dow = DayOfWeek(jd);
add_assoc_long(return_value, "dow", dow);
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]);
add_assoc_string(return_value, "dayname", DayNameLong[dow]);
/* month name */
if(cal == CAL_JEWISH) {
/* special case for Jewish calendar */
add_assoc_string(return_value, "abbrevmonth", (year > 0 ? JEWISH_MONTH_NAME(year)[month] : ""));
add_assoc_string(return_value, "monthname", (year > 0 ? JEWISH_MONTH_NAME(year)[month] : ""));
add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month]);
add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month]);
} else {
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month]);
add_assoc_string(return_value, "monthname", calendar->month_name_long[month]);
@@ -745,7 +735,7 @@ PHP_FUNCTION(jdmonthname)
break;
case CAL_MONTH_JEWISH: /* jewish month */
SdnToJewish(julday, &year, &month, &day);
monthname = (year > 0 ? JEWISH_MONTH_NAME(year)[month] : "");
monthname = JEWISH_MONTH_NAME(year)[month];
break;
case CAL_MONTH_FRENCH: /* french month */
SdnToFrench(julday, &year, &month, &day);
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #67976 (cal_days_month() fails for final month of the French calendar)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
?>
--FILE--
<?php
var_dump(cal_days_in_month(CAL_FRENCH, 13, 14));
?>
--EXPECT--
int(5)
-32
View File
@@ -1,32 +0,0 @@
--TEST--
Bug #71894 (AddressSanitizer: global-buffer-overflow in zif_cal_from_jd)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
?>
--FILE--
<?php
var_dump(cal_from_jd(347997, CAL_JEWISH));
var_dump(jdmonthname(347997,CAL_MONTH_JEWISH));?>
--EXPECT--
array(9) {
["date"]=>
string(5) "0/0/0"
["month"]=>
int(0)
["day"]=>
int(0)
["year"]=>
int(0)
["dow"]=>
NULL
["abbrevdayname"]=>
string(0) ""
["dayname"]=>
string(0) ""
["abbrevmonth"]=>
string(0) ""
["monthname"]=>
string(0) ""
}
string(0) ""
@@ -1,28 +0,0 @@
--TEST--
jdtogregorian(): test overflow
--CREDITS--
neweracracker@gmail.com
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only');
?>
--FILE--
<?php
for ($i=536838860; $i<536838870; $i++) {
echo $i, ':', jdtogregorian($i), PHP_EOL;
}
echo 'DONE', PHP_EOL;
?>
--EXPECT--
536838860:10/11/1465102
536838861:10/12/1465102
536838862:10/13/1465102
536838863:10/14/1465102
536838864:10/15/1465102
536838865:10/16/1465102
536838866:10/17/1465102
536838867:0/0/0
536838868:0/0/0
536838869:0/0/0
DONE
@@ -1,27 +0,0 @@
--TEST--
jdtojewish(): test overflow
--CREDITS--
neweracracker@gmail.com
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
?>
--FILE--
<?php
for ($i=324542840; $i<324542850; $i++) {
echo $i, ':', jdtojewish($i), PHP_EOL;
}
echo 'DONE', PHP_EOL;
?>
--EXPECT--
324542840:12/7/887605
324542841:12/8/887605
324542842:12/9/887605
324542843:12/10/887605
324542844:12/11/887605
324542845:12/12/887605
324542846:12/13/887605
324542847:0/0/0
324542848:0/0/0
324542849:0/0/0
DONE
+1 -6
View File
@@ -100,12 +100,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
{
OLECHAR *olestring;
php_com_dotnet_object *obj;
zend_uchar ztype = IS_NULL;
if (z) {
ZVAL_DEREF(z);
ztype = Z_TYPE_P(z);
}
zend_uchar ztype = (z == NULL ? IS_NULL : Z_TYPE_P(z));
switch (ztype) {
case IS_NULL:
+48 -13
View File
@@ -1876,6 +1876,38 @@ static php_curl *alloc_curl_handle()
/* }}} */
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
/* {{{ split_certinfo
*/
static void split_certinfo(char *string, zval *hash)
{
char *org = estrdup(string);
char *s = org;
char *split;
if(org) {
do {
char *key;
char *val;
char *tmp;
split = strstr(s, "; ");
if(split)
*split = '\0';
key = s;
tmp = memchr(key, '=', 64);
if(tmp) {
*tmp = '\0';
val = tmp+1;
add_assoc_string(hash, key, val);
}
s = split+2;
} while(split);
efree(org);
}
}
/* }}} */
/* {{{ create_certinfo
*/
static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
@@ -1898,7 +1930,16 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
if(tmp) {
*tmp = '\0';
len = strlen(s);
add_assoc_string(&certhash, s, &slist->data[len+1]);
if (!strcmp(s, "Subject") || !strcmp(s, "Issuer")) {
zval hash;
array_init(&hash);
split_certinfo(&slist->data[len+1], &hash);
add_assoc_zval(&certhash, s, &hash);
} else {
add_assoc_string(&certhash, s, &slist->data[len+1]);
}
} else {
php_error_docref(NULL, E_WARNING, "Could not extract hash key from certificate info");
}
@@ -2617,12 +2658,10 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
} ZEND_HASH_FOREACH_END();
if (slist) {
if ((*ch->clone) == 1) {
zend_hash_index_update_ptr(ch->to_free->slist, option, slist);
} else {
zend_hash_next_index_insert_ptr(ch->to_free->slist, slist);
}
if ((*ch->clone) == 1) {
zend_hash_index_update_ptr(ch->to_free->slist, option, slist);
} else {
zend_hash_next_index_insert_ptr(ch->to_free->slist, slist);
}
error = curl_easy_setopt(ch->cp, option, slist);
@@ -3517,7 +3556,7 @@ PHP_FUNCTION(curl_reset)
PHP_FUNCTION(curl_escape)
{
char *str = NULL, *res = NULL;
size_t str_len = 0;
size_t str_len = 0;
zval *zid;
php_curl *ch;
@@ -3529,10 +3568,6 @@ PHP_FUNCTION(curl_escape)
RETURN_FALSE;
}
if (ZEND_SIZE_T_INT_OVFL(str_len)) {
RETURN_FALSE;
}
if ((res = curl_easy_escape(ch->cp, str, str_len))) {
RETVAL_STRING(res);
curl_free(res);
@@ -3560,7 +3595,7 @@ PHP_FUNCTION(curl_unescape)
RETURN_FALSE;
}
if (ZEND_SIZE_T_INT_OVFL(str_len)) {
if (str_len > INT_MAX) {
RETURN_FALSE;
}
+65 -64
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Sun Jul 24 14:52:04 2016 */
/* Generated by re2c 0.13.5 on Wed Jul 20 13:32:20 2016 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@@ -862,6 +862,7 @@ std:
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
if ((YYLIMIT - YYCURSOR) < 31) YYFILL(31);
yych = *YYCURSOR;
switch (yych) {
@@ -972,7 +973,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 976 "<stdout>"
#line 977 "<stdout>"
yy4:
yych = *++YYCURSOR;
if (yych <= 'E') {
@@ -1277,7 +1278,7 @@ yy12:
add_error(s, "Unexpected character");
goto std;
}
#line 1281 "<stdout>"
#line 1282 "<stdout>"
yy13:
yych = *++YYCURSOR;
if (yych <= 'R') {
@@ -2295,7 +2296,7 @@ yy49:
{
goto std;
}
#line 2299 "<stdout>"
#line 2300 "<stdout>"
yy50:
yych = *++YYCURSOR;
goto yy49;
@@ -2306,7 +2307,7 @@ yy51:
s->pos = cursor; s->line++;
goto std;
}
#line 2310 "<stdout>"
#line 2311 "<stdout>"
yy53:
yych = *++YYCURSOR;
goto yy12;
@@ -2373,7 +2374,7 @@ yy56:
if (yyaccept <= 4) {
if (yyaccept <= 2) {
if (yyaccept <= 1) {
if (yyaccept == 0) {
if (yyaccept <= 0) {
goto yy3;
} else {
goto yy12;
@@ -2382,7 +2383,7 @@ yy56:
goto yy49;
}
} else {
if (yyaccept == 3) {
if (yyaccept <= 3) {
goto yy72;
} else {
goto yy166;
@@ -2390,13 +2391,13 @@ yy56:
}
} else {
if (yyaccept <= 6) {
if (yyaccept == 5) {
if (yyaccept <= 5) {
goto yy193;
} else {
goto yy198;
}
} else {
if (yyaccept == 7) {
if (yyaccept <= 7) {
goto yy222;
} else {
goto yy294;
@@ -2406,13 +2407,13 @@ yy56:
} else {
if (yyaccept <= 12) {
if (yyaccept <= 10) {
if (yyaccept == 9) {
if (yyaccept <= 9) {
goto yy392;
} else {
goto yy475;
}
} else {
if (yyaccept == 11) {
if (yyaccept <= 11) {
goto yy490;
} else {
goto yy611;
@@ -2420,13 +2421,13 @@ yy56:
}
} else {
if (yyaccept <= 14) {
if (yyaccept == 13) {
if (yyaccept <= 13) {
goto yy656;
} else {
goto yy666;
}
} else {
if (yyaccept == 15) {
if (yyaccept <= 15) {
goto yy763;
} else {
goto yy783;
@@ -2439,7 +2440,7 @@ yy56:
if (yyaccept <= 21) {
if (yyaccept <= 19) {
if (yyaccept <= 18) {
if (yyaccept == 17) {
if (yyaccept <= 17) {
goto yy814;
} else {
goto yy821;
@@ -2448,7 +2449,7 @@ yy56:
goto yy848;
}
} else {
if (yyaccept == 20) {
if (yyaccept <= 20) {
goto yy793;
} else {
goto yy454;
@@ -2456,13 +2457,13 @@ yy56:
}
} else {
if (yyaccept <= 23) {
if (yyaccept == 22) {
if (yyaccept <= 22) {
goto yy973;
} else {
goto yy842;
}
} else {
if (yyaccept == 24) {
if (yyaccept <= 24) {
goto yy1067;
} else {
goto yy1075;
@@ -2472,13 +2473,13 @@ yy56:
} else {
if (yyaccept <= 29) {
if (yyaccept <= 27) {
if (yyaccept == 26) {
if (yyaccept <= 26) {
goto yy1117;
} else {
goto yy1141;
}
} else {
if (yyaccept == 28) {
if (yyaccept <= 28) {
goto yy1294;
} else {
goto yy1417;
@@ -2486,13 +2487,13 @@ yy56:
}
} else {
if (yyaccept <= 31) {
if (yyaccept == 30) {
if (yyaccept <= 30) {
goto yy1420;
} else {
goto yy1500;
}
} else {
if (yyaccept == 32) {
if (yyaccept <= 32) {
goto yy1508;
} else {
goto yy1531;
@@ -2688,7 +2689,7 @@ yy72:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2692 "<stdout>"
#line 2693 "<stdout>"
yy73:
yych = *++YYCURSOR;
if (yych == 'D') goto yy74;
@@ -3373,7 +3374,7 @@ yy166:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3377 "<stdout>"
#line 3378 "<stdout>"
yy167:
yych = *++YYCURSOR;
if (yych <= 'K') {
@@ -3875,7 +3876,7 @@ yy193:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3879 "<stdout>"
#line 3880 "<stdout>"
yy194:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
@@ -3934,7 +3935,7 @@ yy198:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3938 "<stdout>"
#line 3939 "<stdout>"
yy199:
yyaccept = 6;
yych = *(YYMARKER = ++YYCURSOR);
@@ -4208,7 +4209,7 @@ yy222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4212 "<stdout>"
#line 4213 "<stdout>"
yy223:
yyaccept = 7;
yych = *(YYMARKER = ++YYCURSOR);
@@ -4873,7 +4874,7 @@ yy277:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4877 "<stdout>"
#line 4878 "<stdout>"
yy279:
yych = *++YYCURSOR;
if (yych <= 0x1F) {
@@ -5048,7 +5049,7 @@ yy294:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5052 "<stdout>"
#line 5053 "<stdout>"
yy295:
yych = *++YYCURSOR;
if (yych <= '/') {
@@ -6212,7 +6213,7 @@ yy363:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6216 "<stdout>"
#line 6217 "<stdout>"
yy364:
yych = *++YYCURSOR;
if (yych <= '/') goto yy363;
@@ -6841,7 +6842,7 @@ yy392:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 6845 "<stdout>"
#line 6846 "<stdout>"
yy393:
yyaccept = 5;
yych = *(YYMARKER = ++YYCURSOR);
@@ -8540,7 +8541,7 @@ yy454:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8544 "<stdout>"
#line 8545 "<stdout>"
yy455:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9087,7 +9088,7 @@ yy475:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9091 "<stdout>"
#line 9092 "<stdout>"
yy476:
yyaccept = 10;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9231,7 +9232,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9235 "<stdout>"
#line 9236 "<stdout>"
yy489:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9267,7 +9268,7 @@ yy490:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9271 "<stdout>"
#line 9272 "<stdout>"
yy491:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9563,7 +9564,7 @@ yy522:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9567 "<stdout>"
#line 9568 "<stdout>"
yy524:
yyaccept = 11;
YYMARKER = ++YYCURSOR;
@@ -9672,7 +9673,7 @@ yy534:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 9676 "<stdout>"
#line 9677 "<stdout>"
yy535:
yych = *++YYCURSOR;
if (yych == 'M') goto yy536;
@@ -10347,7 +10348,7 @@ yy604:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10351 "<stdout>"
#line 10352 "<stdout>"
yy607:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -10391,7 +10392,7 @@ yy611:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10395 "<stdout>"
#line 10396 "<stdout>"
yy612:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -11000,7 +11001,7 @@ yy656:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11004 "<stdout>"
#line 11005 "<stdout>"
yy657:
yyaccept = 13;
yych = *(YYMARKER = ++YYCURSOR);
@@ -11111,7 +11112,7 @@ yy666:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11115 "<stdout>"
#line 11116 "<stdout>"
yy667:
yyaccept = 14;
yych = *(YYMARKER = ++YYCURSOR);
@@ -11330,7 +11331,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 11334 "<stdout>"
#line 11335 "<stdout>"
yy701:
yych = *++YYCURSOR;
if (yych <= '5') {
@@ -11830,7 +11831,7 @@ yy763:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11834 "<stdout>"
#line 11835 "<stdout>"
yy764:
yych = *++YYCURSOR;
if (yych == 'C') goto yy765;
@@ -11874,7 +11875,7 @@ yy770:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 11878 "<stdout>"
#line 11879 "<stdout>"
yy772:
yych = *++YYCURSOR;
if (yych == 'V') goto yy765;
@@ -12007,7 +12008,7 @@ yy783:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12011 "<stdout>"
#line 12012 "<stdout>"
yy784:
yych = *++YYCURSOR;
switch (yych) {
@@ -12158,7 +12159,7 @@ yy793:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 12162 "<stdout>"
#line 12163 "<stdout>"
yy794:
yych = *++YYCURSOR;
if (yych == 'I') goto yy927;
@@ -12370,7 +12371,7 @@ yy814:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 12374 "<stdout>"
#line 12375 "<stdout>"
yy815:
yych = *++YYCURSOR;
if (yych <= '/') goto yy56;
@@ -12395,7 +12396,7 @@ yy816:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 12399 "<stdout>"
#line 12400 "<stdout>"
yy818:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -12468,7 +12469,7 @@ yy821:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 12472 "<stdout>"
#line 12473 "<stdout>"
yy822:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -12575,7 +12576,7 @@ yy842:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 12579 "<stdout>"
#line 12580 "<stdout>"
yy843:
yych = *++YYCURSOR;
if (yych <= '2') {
@@ -12842,7 +12843,7 @@ yy848:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 12846 "<stdout>"
#line 12847 "<stdout>"
yy849:
yych = *++YYCURSOR;
if (yych <= 'H') {
@@ -13649,7 +13650,7 @@ yy973:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 13653 "<stdout>"
#line 13654 "<stdout>"
yy974:
yyaccept = 22;
yych = *(YYMARKER = ++YYCURSOR);
@@ -14583,7 +14584,7 @@ yy1067:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 14587 "<stdout>"
#line 14588 "<stdout>"
yy1068:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -14686,7 +14687,7 @@ yy1075:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 14690 "<stdout>"
#line 14691 "<stdout>"
yy1076:
yyaccept = 25;
yych = *(YYMARKER = ++YYCURSOR);
@@ -15558,7 +15559,7 @@ yy1117:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 15562 "<stdout>"
#line 15563 "<stdout>"
yy1118:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -15621,7 +15622,7 @@ yy1125:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 15625 "<stdout>"
#line 15626 "<stdout>"
yy1127:
yyaccept = 26;
yych = *(YYMARKER = ++YYCURSOR);
@@ -15737,7 +15738,7 @@ yy1141:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 15741 "<stdout>"
#line 15742 "<stdout>"
yy1142:
yych = *++YYCURSOR;
goto yy1117;
@@ -18283,7 +18284,7 @@ yy1294:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 18287 "<stdout>"
#line 18288 "<stdout>"
yy1295:
yyaccept = 28;
yych = *(YYMARKER = ++YYCURSOR);
@@ -18538,7 +18539,7 @@ yy1315:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 18542 "<stdout>"
#line 18543 "<stdout>"
yy1317:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -19923,7 +19924,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 19927 "<stdout>"
#line 19928 "<stdout>"
yy1388:
yych = *++YYCURSOR;
if (yych <= 'N') {
@@ -20340,7 +20341,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20344 "<stdout>"
#line 20345 "<stdout>"
yy1418:
yych = *++YYCURSOR;
if (yych <= 'Y') {
@@ -20381,7 +20382,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20385 "<stdout>"
#line 20386 "<stdout>"
yy1421:
yych = *++YYCURSOR;
if (yych <= 'S') {
@@ -22321,7 +22322,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22325 "<stdout>"
#line 22326 "<stdout>"
yy1501:
yych = *++YYCURSOR;
if (yych <= 'N') {
@@ -22463,7 +22464,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22467 "<stdout>"
#line 22468 "<stdout>"
yy1509:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -22984,7 +22985,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22988 "<stdout>"
#line 22989 "<stdout>"
yy1532:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
+807 -646
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -3611,7 +3611,6 @@ static int timezone_initialize(php_timezone_obj *tzobj, /*const*/ char *tz, size
if (strlen(tz) != tz_len) {
php_error_docref(NULL, E_WARNING, "Timezone must not contain null bytes");
efree(dummy_t);
return FAILURE;
}
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #66836 (DateTime::createFromFormat 'U' with pre 1970 dates fails parsing)
--INI--
date.timezone=Europe/Berlin
--FILE--
<?php
foreach (['-1', '-86400', '-1000000'] as $timestamp) {
$dt = DateTime::createFromFormat('U', $timestamp);
var_dump($dt->format('U') === $timestamp);
}
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #66502 (DOM document dangling reference)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip requires ext/dom');
?>
--FILE--
<?php
$dom = new DOMDocument('1.0', 'UTF-8');
$element = $dom->appendChild(new DOMElement('root'));
$comment = new DOMComment("Comment 0");
$comment = $element->appendChild($comment);
$comment->__construct("Comment 1");
$comment->__construct("Comment 2");
$comment->__construct("Comment 3");
echo 'DONE', PHP_EOL;
?>
--EXPECT--
DONE
+2 -16
View File
@@ -1703,10 +1703,6 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
break;
case TAG_FMT_UNDEFINED:
if (value) {
if (tag == TAG_MAKER_NOTE) {
length = MIN(length, strlen(value));
}
/* do not recompute length here */
info_value->s = estrndup(value, length);
info_data->length = length;
@@ -2716,14 +2712,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
char *dir_start;
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "No maker note data found. Detected maker: %s (length = %d)", ImageInfo->make, strlen(ImageInfo->make));
#endif
/* unknown manufacturer, not an error, use it as a string */
return TRUE;
}
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
return FALSE;
maker_note = maker_note_array+i;
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
@@ -3757,10 +3747,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF(ImageInfo)
efree(ImageInfo->Thumbnail.data);
ImageInfo->Thumbnail.data = NULL;
} else {
exif_thumbnail_build(ImageInfo);
}
exif_thumbnail_build(ImageInfo);
}
-71
View File
@@ -1,71 +0,0 @@
--TEST--
Bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true);
var_dump($exif);
?>
--EXPECTF--
Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d
Warning: exif_read_data(%s): Error in TIFF: filesize(x04E2) less than start of IFD dir(x829A0004) in %sbug72627.php on line %d
Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d
array(11) {
["FileName"]=>
string(13) "bug72627.tiff"
["FileDateTime"]=>
int(%d)
["FileSize"]=>
int(1250)
["FileType"]=>
int(7)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF"
["COMPUTED"]=>
array(10) {
["html"]=>
string(24) "width="128" height="132""
["Height"]=>
int(132)
["Width"]=>
int(128)
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(0)
["ApertureFNumber"]=>
string(5) "f/1.0"
["Thumbnail.FileType"]=>
int(2)
["Thumbnail.MimeType"]=>
string(10) "image/jpeg"
["Thumbnail.Height"]=>
int(132)
["Thumbnail.Width"]=>
int(128)
}
["XResolution"]=>
string(21) "1414812756/1414812756"
["THUMBNAIL"]=>
array(5) {
["ImageWidth"]=>
int(128)
["ImageLength"]=>
int(132)
["JPEGInterchangeFormat"]=>
int(1280)
["JPEGInterchangeFormatLength"]=>
int(100)
["THUMBNAIL"]=>
NULL
}
["ExposureTime"]=>
string(21) "1414812756/1414812756"
["FNumber"]=>
string(21) "1414812756/1414812756"
}
Binary file not shown.
+1 -10
View File
@@ -779,7 +779,6 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_PRIV_RANGE) {
if (
(ip[0] == 10) ||
(ip[0] == 169 && ip[1] == 254) ||
(ip[0] == 172 && (ip[1] >= 16 && ip[1] <= 31)) ||
(ip[0] == 192 && ip[1] == 168)
) {
@@ -790,18 +789,10 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
(ip[0] == 10) ||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
(ip[0] == 127) ||
(ip[0] == 169 && ip[1] == 254) ||
(ip[0] == 172 && (ip[1] >= 16 && ip[1] <= 31)) ||
(ip[0] == 192 && ip[1] == 0 && ip[2] == 0) ||
(ip[0] == 192 && ip[1] == 0 && ip[2] == 2) ||
(ip[0] == 192 && ip[1] == 88 && ip[2] == 99) ||
(ip[0] == 192 && ip[1] == 168) ||
(ip[0] == 198 && (ip[1] == 18 || ip[1] == 19)) ||
(ip[0] == 198 && ip[1] == 51 && ip[2] == 100) ||
(ip[0] == 203 && ip[1] == 0 && ip[2] == 113) ||
(ip[0] == 127 && ip[1] == 0 && ip[2] == 0 && ip[3] == 1) ||
(ip[0] >= 224 && ip[0] <= 255)
) {
RETURN_VALIDATION_FAILED
+1 -1
View File
@@ -41,7 +41,7 @@ string(9) "127.0.0.1"
bool(false)
string(12) "192.0.34.166"
bool(false)
bool(false)
string(9) "192.0.0.1"
bool(false)
bool(false)
string(12) "192.0.34.166"
-137
View File
@@ -1,137 +0,0 @@
--TEST--
Bug #71745 FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8 range
--FILE--
<?php
//https://tools.ietf.org/html/rfc6890#section-2.1
$privateRanges = array();
// 10.0.0.0/8
$privateRanges['10.0.0.0/8'] = array('10.0.0.0', '10.255.255.255');
// 169.254.0.0/16
$privateRanges['168.254.0.0/16'] = array('169.254.0.0', '169.254.255.255');
// 172.16.0.0/12
$privateRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0');
// 192.168.0.0/16
$privateRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255');
foreach ($privateRanges as $key => $range) {
list($min, $max) = $range;
var_dump($key);
var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
}
$reservedRanges = array();
// 0.0.0.0/8
$reserverRanges['0.0.0.0/8'] = array('0.0.0.0', '0.255.255.255');
// 10.0.0.0/8
$reserverdRanges['10.0.0.0/8'] = array('10.0.0.0', '10.255.255.255');
// 100.64.0.0/10
$reserverdRanges['10.64.0.0/10'] = array('100.64.0.0', '100.127.255.255');
// 127.0.0.0/8
$reserverdRanges['127.0.0.0/8'] = array('127.0.0.0', '127.255.255.255');
// 169.254.0.0/16
$reserverdRanges['169.254.0.0/16'] = array('169.254.0.0', '169.254.255.255');
// 172.16.0.0/12
$reserverdRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0');
// 192.0.0.0/24
$reserverdRanges['192.0.0.0/24'] = array('192.0.0.0', '192.0.0.255');
// 192.0.0.0/29
$reserverdRanges['192.0.0.0/29'] = array('192.0.0.0', '192.0.0.7');
// 192.0.2.0/24
$reserverdRanges['192.0.2.0/24'] = array('192.0.2.0', '192.0.2.255');
// 198.18.0.0/15
$reserverdRanges['198.18.0.0/15'] = array('198.18.0.0', '198.19.255.255');
// 198.51.100.0/24
$reserverdRanges['198.51.100.0/24'] = array('198.51.100.0', '198.51.100.255');
// 192.88.99.0/24
$reserverdRanges['192.88.99.0/24'] = array('192.88.99.0', '192.88.99.255');
// 192.168.0.0/16
$reserverdRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255');
// 203.0.113.0/24
$reserverdRanges['203.0.113.0/24'] = array('203.0.113.0', '203.0.113.255');
// 240.0.0.0/4 + 255.255.255.255/32
$reserverdRanges['240.0.0.0/4'] = array('224.0.0.0', '255.255.255.255');
foreach ($reserverdRanges as $key => $range) {
list($min, $max) = $range;
var_dump($key);
var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
}
--EXPECT--
string(10) "10.0.0.0/8"
bool(false)
bool(false)
string(14) "168.254.0.0/16"
bool(false)
bool(false)
string(13) "172.16.0.0/12"
bool(false)
bool(false)
string(14) "192.168.0.0/16"
bool(false)
bool(false)
string(10) "10.0.0.0/8"
bool(false)
bool(false)
string(12) "10.64.0.0/10"
bool(false)
bool(false)
string(11) "127.0.0.0/8"
bool(false)
bool(false)
string(14) "169.254.0.0/16"
bool(false)
bool(false)
string(13) "172.16.0.0/12"
bool(false)
bool(false)
string(12) "192.0.0.0/24"
bool(false)
bool(false)
string(12) "192.0.0.0/29"
bool(false)
bool(false)
string(12) "192.0.2.0/24"
bool(false)
bool(false)
string(13) "198.18.0.0/15"
bool(false)
bool(false)
string(15) "198.51.100.0/24"
bool(false)
bool(false)
string(14) "192.88.99.0/24"
bool(false)
bool(false)
string(14) "192.168.0.0/16"
bool(false)
bool(false)
string(14) "203.0.113.0/24"
bool(false)
bool(false)
string(11) "240.0.0.0/4"
bool(false)
bool(false)
+46 -47
View File
@@ -1,49 +1,48 @@
-----BEGIN CERTIFICATE REQUEST-----
MIIBmzCCAQQCAQAwWzELMAkGA1UEBhMCUFQxCzAJBgNVBAgTAkx4MQswCQYDVQQH
EwJMeDEcMBoGA1UEChMTQSBtaW5oYSBlbXByZXNhLCBTQTEUMBIGA1UECxMLUEhQ
IFFBIFRlYW0wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM9mfEOSYwXf58ch
4NyO1QOU1XMfquz8OVpvMUITABLAevZpeQn6vZPHNyXHFQC0QC8scydK1rAYd2U+
9K2aPub6ioMjYyjPpAE07l9EAAPUEBlqqsziB/wT8QjWkByyJEkYu+o0Wyjokhfn
BMPvm52wLWUx9nvUeNDCftnKg1wxAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQDD
s1FeqPxnF2bWj8/dG8MyPaRfOAMVz1UsCZUciXIVG5LSIvR2qnMC3iEYt3s13sEq
z8VJlNHa8nniE+VFNv093yIu+PlWXMEvb5y5EFqP2AYq3RAT+SJsSxGqIdzPZiKY
INaktLCZmQ/E1v7/4hFzVRq9ydJI82DVS1nv282Whw==
-----END CERTIFICATE REQUEST-----
-----BEGIN CERTIFICATE-----
MIIDhTCCAm2gAwIBAgIJAN75FFz+owOAMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMMCTEyNy4wLjAuMTAeFw0xNjA3MjUxMjM3
MTJaFw0yNjA3MjMxMjM3MTJaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21l
LVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNV
BAMMCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALtG
AIrNUDItISfpAqztL2TFEWEHLGTzCEh5Ag2sdMD7UYbqIPHLOE4EINv+dqEMM0Nz
LYnw7ChtVegXT907xCaQcmeDFSdhqze4L8zawDfnn4syB8XAwGYJfpstYwe3nO6+
0WvLSb1A5TYNeyoXjwlAUKElxkeWAo51uhR41GDhDQ9GgpqX1ccAhmSoUhgIRSzf
6f4KE3WTdzl1p12ZtkYHB8Jo2jB/JXnwGOz6isLnpRvkex4B7sUX+7u1MqK/e1X7
Hi1G/VkaAfC2SOfjTePtGBDBXrQ1arYXDPRA04sgFzSh55l7lC/4HasQ/jAb3h95
dcEIqyc69iioaN1c1NcCAwEAAaNQME4wHQYDVR0OBBYEFNv3kefb1H+6/6CpjiBi
+I2s9E90MB8GA1UdIwQYMBaAFNv3kefb1H+6/6CpjiBi+I2s9E90MAwGA1UdEwQF
MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAIzSEWpHSaBs7KduBRXX5+qFxBN6OCPl
7ID0rxAOYfw7ruzbmwgOpBgMIHGn+KqA6CmQI0jh9bZbv5TV2aFpFsUihugPc2lW
5EshCozxlEPmIJNsO8jDqPE4w3m4KiVTscRWjBa5cco+lwLDqboerm2l7vvrtr6B
pgLaZct1c73MouvoJSCGK5EOGW7jsgaxjxJ3UZug+24Ko1wulO2cgBLhda9Ilrnx
CIKI9h8Z2WVWuVQfyCyO1g7XkJgkBec77OhxD+m4onzPY6waqnnhmFOBcS+gKgBV
jHeK9DCvZ9zet3EyEp6fyQOOtsC+gU0piYgfsQL7aCp5oLe+fjTiuUY=
MIIC4zCCAkygAwIBAgIBADANBgkqhkiG9w0BAQQFADBbMQswCQYDVQQGEwJQVDEL
MAkGA1UECBMCTHgxCzAJBgNVBAcTAkx4MRwwGgYDVQQKExNBIG1pbmhhIGVtcHJl
c2EsIFNBMRQwEgYDVQQLEwtQSFAgUUEgVGVhbTAeFw0wNjExMTkxODIzNTNaFw0w
NzExMTkxODIzNTNaMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UE
BxMCTHgxHDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BI
UCBRQSBUZWFtMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPZnxDkmMF3+fH
IeDcjtUDlNVzH6rs/DlabzFCEwASwHr2aXkJ+r2TxzclxxUAtEAvLHMnStawGHdl
PvStmj7m+oqDI2Moz6QBNO5fRAAD1BAZaqrM4gf8E/EI1pAcsiRJGLvqNFso6JIX
5wTD75udsC1lMfZ71HjQwn7ZyoNcMQIDAQABo4G2MIGzMB0GA1UdDgQWBBTIga5L
q+Ub1SWXgNZRYCpq3c8Z+jCBgwYDVR0jBHwweoAUyIGuS6vlG9Ull4DWUWAqat3P
GfqhX6RdMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UEBxMCTHgx
HDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BIUCBRQSBU
ZWFtggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAe6AA8aC3KDI8
smd+7XWjaTSp1Q0uMkEZ2PEBzif2I1aPPqw1CQykJ1iDdC/8PJ1yEIezloP2XQoZ
NjTaCO+uubay03ncoPTZvDUwExN9BYFAYgc2z3tLMHYbA7kM2sIbKys7ZQegLibr
TSKYQOBeYA/FB9GHECJGU3zBRvYi+Og=
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7RgCKzVAyLSEn
6QKs7S9kxRFhByxk8whIeQINrHTA+1GG6iDxyzhOBCDb/nahDDNDcy2J8OwobVXo
F0/dO8QmkHJngxUnYas3uC/M2sA355+LMgfFwMBmCX6bLWMHt5zuvtFry0m9QOU2
DXsqF48JQFChJcZHlgKOdboUeNRg4Q0PRoKal9XHAIZkqFIYCEUs3+n+ChN1k3c5
daddmbZGBwfCaNowfyV58Bjs+orC56Ub5HseAe7FF/u7tTKiv3tV+x4tRv1ZGgHw
tkjn403j7RgQwV60NWq2Fwz0QNOLIBc0oeeZe5Qv+B2rEP4wG94feXXBCKsnOvYo
qGjdXNTXAgMBAAECggEAD7yDISa9fWnjZlojGmrX16zjl/alWVo+sPBSJtn9+ZVk
tWSJHihIc+3O4Q2R5FiFGj7cbcHr5j3BwT3sPRfflKoAowgVx/hiDc2RXrJnAouZ
EXZDxu86e5iCpgF7V9OrATjRmjA74wZH/HHHjrLqFwnrfI8TCULmthfYag35Mqax
qrIEzvSuYdaGxblNe+ZfnVEDW2F9DLBGcma0ffUlJp8AvV7bpo8Rj/JovPxit/VS
UdwSRxwSAugctFpmcGlFkoQfxUx1WdEy8hjopLrayMjCCJvRUL4+C4zT9r9PBHOj
fCSbJ+ajQIoRrgaL9bURk8BFMHY8+yMUsWEYVSmFAQKBgQDtOvPkhvZsNocUB5nJ
ti3SXyDQ6OZQuKKHPSeDV/EvmZKeNlrQ1ZnwXLP3vkcedDOkt1nEVq/hUewpjt08
2MvmMwJBQEnmbTzMf43DtlXsStdP1lhYaFbU4iMM5zRfyBHDu1GPZEPXvKKpJUk0
M+jYIyTAP3mcZhqDKn0mPVP7VwKBgQDKFy9DtWFKxCvhFQvHx7YeZiVWJbIst/O4
ZyuPVAErni0hzSeCkmm7+F9hgEdPSLRcSaeTWP4L0u1cixECKboIhoNs38aft7o3
MdnI2RDSEKtKX2uVuhvpGDNuGpBAc8Qu8iCiv5INSC36ZhD1h++O/TiiUdgRJ3yX
yeG7ej+CgQKBgCR5F95e0aw5hfMSaBaXJ9xcO9Niu2ZVvMdGI7kR4EcNOXmRqczJ
ym0mE5VXb9/Cxd3hQq/pFAl0avbIvEMKoe62kPYvSC1hRiO6yLT6Z6N4rjncHqEZ
CaCZVAI72dWQEQsi1ZtSMwwMOIYA8YxRHs98N75HBA+DszfPZIZoj2zpAoGBAJHp
B3ElhmeLF/tdTLIj2bQ9H/wBH5H2Bvw/UU4c4vNxMzjSfRJjUAAtpgAptFLkNYTk
kR9sA5DZ7BMDPXaIVg9Nv5peP3SWHNc5IPtI7kIdUu9R0cW7J+e2V3vJphlC/ITA
wRuAoZ0BXmEKTHhae3aMEdXwrcZE8kpNsrO/4hcBAoGBAMISiPJPuxAX1UtqcxTa
mDJfnQ2gxRu6AK9VmXqo0X4IBxDSnTjcL0huUlS849wgsE5oTXgdYb2hn+TXM5JJ
NsEXLhV09X1mrk4M4LV1npd0mYxvFsO4+p+IX5YLiahInmQtq0gx3DWE8wouVFER
4yzfp27z8MZT8Qvr/ZI9lzWd
-----END PRIVATE KEY-----
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,928762DB6DE222AD
oOxNUBX0wrqmRqb3IEZMogc1bnVm6JoW6YFjGfHNcIz0jS7UPDhUFDR26y0dYujL
LEgxOcYo8ItvGcXSRbs+3W7lISbosgkB0DOaKx5jVmOGwUVRergUUSY8rbf93FtP
27CEvAfsU6do5HmlJ34mYZW1k+onCznlJXJkupQ5jmiily3GwEdr/5mMIVOmXQ6p
xWkxHySDKyVbR0v4JY3SJLRBuhgofYNG5155PiqZ7KwYY4Aw60eVgINsvJCF9/8b
kEj+lecHbBdAf7N82320Ga+F+VeFnUl0gWFjoIF9UFCO80+7ZvIGdGlyPkr4zMvt
TsC1snJQdHg+IlT3sGayYrQANpTG6GPYhn3KEvK5aqq+bPEe5lija0gw34jbPCo+
TjHR76lToxzubGZODyyF/rjl5KwUbqTCNuv1PX1jTx7n7sCbu+KHpqXMhTHLKtby
+Wh7WAfsVrbIW+P85/mkfhPbPZ2621f9cyStdFGgWU4dHdD00HIGOgAJvUSbC2Au
oVUoKf2818t1s9aA4ptog04sNi+Ixu+z+3yYNLZj51j4ZX3KuXxLIiQvlvFQ8LQi
RHGQk3u2W3iNtDKKUQjMPaB2FlVtC7FmtHBCpRmos6ld240DDyucqMdIDTMaqV0+
sL4X+LIeBM/hP/IquRTuQBHBmgjkN4845ihTUJOanyKx605ANq/roHzXrbIxhR5p
pcJLCBMLMWgdOCJMZRavSq04iXeNfP6Mk/joVpHS62Ljdfc94BBLfsOKOErA20Nq
lfvbZqy2tI5IIDoq05S8FU0DYNqq/hyrv9Udo8IAo+WkBOABm0x/WA==
-----END RSA PRIVATE KEY-----
+11 -29
View File
@@ -2,7 +2,7 @@
$socket = null;
$errno = 0;
$context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem')));
$context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem', 'passphrase' => 'pass')));
for ($i=0; $i<10 && !$socket; ++$i) {
$port = rand(50000, 65535);
@@ -265,7 +265,7 @@ if ($pid) {
} elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
if (isset($m[1]) && $m[1] === 'bogusdir') {
fputs($s, "250 $m[1]: No such file or directory\r\n");
continue;
}
@@ -276,17 +276,12 @@ if ($pid) {
continue;
}
if (empty($pasv)) {
fputs($s, "150 File status okay; about to open data connection\r\n");
if (!$fs = stream_socket_client("tcp://$host:$port")) {
fputs($s, "425 Can't open data connection\r\n");
continue;
}
} else {
fputs($s, "125 Data connection already open; transfer starting.\r\n");
$fs=$pasvs;
}
fputs($s, "150 File status okay; about to open data connection\r\n");
if (!$fs = stream_socket_client("tcp://$host:$port")) {
fputs($s, "425 Can't open data connection\r\n");
continue;
}
if (empty($m[1]) || $m[1] !== 'emptydir') {
fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n");
@@ -373,7 +368,7 @@ if ($pid) {
}
fputs($s, "226 Closing data Connection.\r\n");
break;
case "mediumfile":
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");
@@ -389,26 +384,13 @@ if ($pid) {
}elseif (preg_match('/^PASV/', $buf, $matches)) {
$pasv=true;
$p2 = $pasv_port % ((int) 1 << 8);
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
$port = $pasv_port;
$p2 = $port % ((int) 1 << 8);
$p1 = ($port-$p2)/((int) 1 << 8);
$host = "127.0.0.1";
if (!empty($ssl)) {
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
} else {
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
}
fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
$pasvs = stream_socket_accept($soc,10);
if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
die("SSLv23 handshake failed.\n");
}
}elseif (preg_match('/^EPSV/', $buf, $matches)) {
fputs($s, "550 Extended passsive mode not supported.\r\n");
} elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
fputs($s, "200 OK\r\n");
+5 -29
View File
@@ -63,9 +63,6 @@
static int le_gd, le_gd_font;
#include <gd.h>
#ifndef HAVE_GD_BUNDLED
# include <gd_errors.h>
#endif
#include <gdfontt.h> /* 1 Tiny font */
#include <gdfonts.h> /* 2 Small font */
#include <gdfontmb.h> /* 3 Medium bold font */
@@ -1024,19 +1021,7 @@ static void php_free_gd_font(zend_resource *rsrc)
void php_gd_error_method(int type, const char *format, va_list args)
{
switch (type) {
case GD_DEBUG:
case GD_INFO:
case GD_NOTICE:
type = E_NOTICE;
break;
case GD_WARNING:
type = E_WARNING;
break;
default:
type = E_ERROR;
}
php_verror(NULL, "", type, format, args TSRMLS_CC);
php_verror(NULL, "", type, format, args);
}
/* }}} */
#endif
@@ -1062,7 +1047,6 @@ PHP_MINIT_FUNCTION(gd)
REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_WEBP", 32, CONST_CS | CONST_PERSISTENT);
/* special colours for gd */
REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
@@ -1530,11 +1514,11 @@ PHP_FUNCTION(imagetruecolortopalette)
RETURN_FALSE;
}
if (ncolors <= 0 || ZEND_LONG_INT_OVFL(ncolors)) {
php_error_docref(NULL, E_WARNING, "Number of colors has to be greater than zero and no more than %d", INT_MAX);
if (ncolors <= 0) {
php_error_docref(NULL, E_WARNING, "Number of colors has to be greater than zero");
RETURN_FALSE;
}
gdImageTrueColorToPalette(im, dither, (int)ncolors);
gdImageTrueColorToPalette(im, dither, ncolors);
RETURN_TRUE;
}
@@ -2140,9 +2124,6 @@ PHP_FUNCTION(imagetypes)
#if defined(HAVE_GD_XPM)
ret |= 16;
#endif
#ifdef HAVE_GD_WEBP
ret |= 32;
#endif
if (zend_parse_parameters_none() == FAILURE) {
return;
@@ -3032,11 +3013,6 @@ PHP_FUNCTION(imagegammacorrect)
return;
}
if ( input <= 0.0 || output <= 0.0 ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Gamma values should be positive");
RETURN_FALSE;
}
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
RETURN_FALSE;
}
@@ -4642,7 +4618,7 @@ PHP_FUNCTION(imagecropauto)
case GD_CROP_THRESHOLD:
if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color argument missing with threshold mode");
php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode");
RETURN_FALSE;
}
im_crop = gdImageCropThreshold(im, color, (float) threshold);
+22 -74
View File
@@ -1299,55 +1299,10 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
long x, y, inc;
long dx, dy,tmp;
if (y1 < 0 && y2 < 0) {
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
return;
}
if (y1 < 0) {
x1 += (y1 * (x1 - x2)) / (y2 - y1);
y1 = 0;
}
if (y2 < 0) {
x2 += (y2 * (x1 - x2)) / (y2 - y1);
y2 = 0;
}
/* bottom edge */
if (y1 >= im->sy && y2 >= im->sy) {
return;
}
if (y1 >= im->sy) {
x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1);
y1 = im->sy - 1;
}
if (y2 >= im->sy) {
x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1);
y2 = im->sy - 1;
}
/* left edge */
if (x1 < 0 && x2 < 0) {
return;
}
if (x1 < 0) {
y1 += (x1 * (y1 - y2)) / (x2 - x1);
x1 = 0;
}
if (x2 < 0) {
y2 += (x2 * (y1 - y2)) / (x2 - x1);
x2 = 0;
}
/* right edge */
if (x1 >= im->sx && x2 >= im->sx) {
return;
}
if (x1 >= im->sx) {
y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1);
x1 = im->sx - 1;
}
if (x2 >= im->sx) {
y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1);
x2 = im->sx - 1;
}
dx = x2 - x1;
dy = y2 - y1;
@@ -1668,17 +1623,23 @@ long lsqrt (long n)
/* s and e are integers modulo 360 (degrees), with 0 degrees
being the rightmost extreme and degrees changing clockwise.
cx and cy are the center in pixels; w and h are the horizontal
and vertical diameter in pixels. */
and vertical diameter in pixels. Nice interface, but slow.
See gd_arc_f_buggy.c for a better version that doesn't
seem to be bug-free yet. */
void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color)
{
gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill);
if ((s % 360) == (e % 360)) {
gdImageEllipse(im, cx, cy, w, h, color);
} else {
gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill);
}
}
void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style)
{
gdPoint pts[363];
int i, pti;
gdPoint pts[3];
int i;
int lx = 0, ly = 0;
int fx = 0, fy = 0;
@@ -1706,7 +1667,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
}
}
for (i = s, pti = 1; i <= e; i++, pti++) {
for (i = s; i <= e; i++) {
int x, y;
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
@@ -1715,28 +1676,19 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
if (style & gdNoFill) {
gdImageLine(im, lx, ly, x, y, color);
} else {
if (y == ly) {
pti--; /* don't add this point */
if (((i > 270 || i < 90) && x > lx) || ((i > 90 && i < 270) && x < lx)) {
/* replace the old x coord, if increasing on the
right side or decreasing on the left side */
pts[pti].x = x;
}
} else {
pts[pti].x = x;
pts[pti].y = y;
}
}
/* This is expensive! */
pts[0].x = lx;
pts[0].y = ly;
pts[1].x = x;
pts[1].y = y;
pts[2].x = cx;
pts[2].y = cy;
gdImageFilledPolygon(im, pts, 3, color);
}
}
} else {
fx = x;
fy = y;
if (!(style & (gdChord | gdNoFill))) {
pts[0].x = cx;
pts[0].y = cy;
pts[pti].x = x;
pts[pti].y = y;
}
}
lx = x;
ly = y;
@@ -1763,10 +1715,6 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
gdImageLine(im, cx, cy, lx, ly, color);
gdImageLine(im, cx, cy, fx, fy, color);
}
} else {
pts[pti].x = cx;
pts[pti].y = cy;
gdImageFilledPolygon(im, pts, pti+1, color);
}
}
}
+30 -10
View File
@@ -1509,8 +1509,13 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
src_offset_y[0] = m;
}
src_offset_x[1] = n;
src_offset_y[1] = m;
if (m < 1) {
src_offset_x[1] = n;
src_offset_y[1] = m;
} else {
src_offset_x[1] = n;
src_offset_y[1] = m;
}
if ((m < 1) || (n >= src_w - 1)) {
src_offset_x[2] = n;
@@ -1562,8 +1567,13 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
src_offset_y[8] = m;
}
src_offset_x[9] = n;
src_offset_y[9] = m;
if (m >= src_h - 1) {
src_offset_x[8] = n;
src_offset_y[8] = m;
} else {
src_offset_x[9] = n;
src_offset_y[9] = m;
}
if ((m >= src_h-1) || (n >= src_w-1)) {
src_offset_x[10] = n;
@@ -1589,8 +1599,13 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
src_offset_y[12] = m;
}
src_offset_x[13] = n;
src_offset_y[13] = m;
if (m >= src_h - 2) {
src_offset_x[13] = n;
src_offset_y[13] = m;
} else {
src_offset_x[13] = n;
src_offset_y[13] = m;
}
if ((m >= src_h - 2) || (n >= src_w - 1)) {
src_offset_x[14] = n;
@@ -1999,8 +2014,13 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const
src_offset_y[0] = m;
}
src_offset_x[1] = n;
src_offset_y[1] = m;
if (m < 1) {
src_offset_x[1] = n;
src_offset_y[1] = m;
} else {
src_offset_x[1] = n;
src_offset_y[1] = m ;
}
if ((m < 1) || (n >= src_w-1)) {
src_offset_x[2] = - 1;
@@ -2053,8 +2073,8 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const
}
if (m >= src_h-1) {
src_offset_x[9] = - 1;
src_offset_y[9] = - 1;
src_offset_x[8] = - 1;
src_offset_y[8] = - 1;
} else {
src_offset_x[9] = n;
src_offset_y[9] = m;
+1 -1
View File
@@ -329,7 +329,7 @@ han2zen (int *p1, int *p2)
{
if ((*p2 >= 74 && *p2 <= 103) || (*p2 >= 110 && *p2 <= 122))
(*p2)++;
else if (*p2 == 131 || *p2 == 69)
else if (*p2 == 131 && *p2 == 69)
*p2 = 148;
}
else if (handaku && *p2 >= 110 && *p2 <= 122)
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #43828 (broken transparency of imagearc for truecolor in blendingmode)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip ext/gd not available');
?>
--FILE--
<?php
$im = imagecreatetruecolor(100,100);
$transparent = imagecolorallocatealpha($im, 255, 255, 255, 80);
imagefilledrectangle($im, 0,0, 99,99, $transparent);
$color = imagecolorallocatealpha($im, 0, 255, 0, 100);
imagefilledarc($im, 49, 49, 99,99, 0 , 360, $color, IMG_ARC_PIE);
ob_start();
imagepng($im);
echo md5(ob_get_clean());
imagedestroy($im);
?>
--EXPECT--
3d82e4525f19790ae1055366e2a36917
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #72596 (imagetypes function won't advertise WEBP support)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
var_dump(function_exists('imagewebp') === (bool) (imagetypes() & IMG_WEBP));
?>
--EXPECT--
bool(true)
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #72604 (imagearc() ignores thickness for full arcs)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip requires ext/gd');
if (!(imagetypes() & IMG_PNG)) die('skip requires PNG support');
?>
--FILE--
<?php
$im = imagecreatetruecolor(100, 100);
imagesetthickness($im, 5);
imagearc($im, 50, 50, 90, 90, 0, 360, 0xffffff);
ob_start();
imagepng($im);
$imagestring = ob_get_clean();
echo md5($imagestring);
?>
--EXPECT--
2ffa6afb915afbdf870cf6459477bc8a
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #72697: select_colors write out-of-bounds
--SKIPIF--
<?php
if (!function_exists("imagecreatetruecolor")) die("skip");
if (PHP_INT_MAX !== 9223372036854775807) die("skip for 64-bit long systems only");
?>
--FILE--
<?php
$img=imagecreatetruecolor(10, 10);
imagetruecolortopalette($img, false, PHP_INT_MAX / 8);
?>
DONE
--EXPECTF--
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than 2147483647 in %sbug72697.php on line %d
DONE
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #72730: imagegammacorrect allows arbitrary write access
--SKIPIF--
<?php
if (!function_exists("imagecreatetruecolor")) die("skip");
?>
--FILE--
<?php
$img = imagecreatetruecolor(1, 1);
imagegammacorrect($img, -1, 1337);
?>
DONE
--EXPECTF--
Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d
DONE
+10 -12
View File
@@ -25,26 +25,24 @@ var_dump(gd_info());
*** Testing gd_info() : variation ***
array(%d) {
["GD Version"]=>
string(%d) %s
string(%d) %a
["FreeType Support"]=>
bool(%a
bool%a
["GIF Read Support"]=>
bool(%s)
bool%a
["GIF Create Support"]=>
bool(%s)
bool%a
["JPEG Support"]=>
bool(%s)
bool%a
["PNG Support"]=>
bool(%s)
bool%a
["WBMP Support"]=>
bool(%s)
bool%a
["XPM Support"]=>
bool(%s)
bool%a
["XBM Support"]=>
bool(%s)
["WebP Support"]=>
bool(%s)
bool%a
["JIS-mapped Japanese Font Support"]=>
bool(%s)
bool%a
}
===DONE===
@@ -26,5 +26,5 @@ var_dump(md5(base64_encode($imgsrc)));
var_dump($corA);
?>
--EXPECT--
string(32) "f95489d97f4f1a5c4dc265388922d1ec"
string(32) "2a6424e4cb4e1b7391dfff74bf136bde"
int(842163455)
@@ -25,4 +25,4 @@ Warning: imagetruecolortopalette() expects parameter 3 to be integer, resource g
Warning: imagetruecolortopalette() expects parameter 3 to be integer, array given in %s on line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
@@ -16,6 +16,6 @@ imagetruecolortopalette($image, true, -1);
?>
--EXPECTF--
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
+1 -6
View File
@@ -588,15 +588,10 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
zval *zv;
int retval = FAILURE;
php_unserialize_data_t unserialize_data = (php_unserialize_data_t) data;
zval object_copy;
PHP_VAR_UNSERIALIZE_INIT(unserialize_data);
gmp_create(object, &gmpnum);
/* The "object" variable may be modified during the execution of this unserialize handler
* (it may turn into a reference). Keep the original object around for futher operations. */
ZVAL_COPY_VALUE(&object_copy, object);
p = buf;
max = buf + buf_len;
@@ -619,7 +614,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
if (zend_hash_num_elements(Z_ARRVAL_P(zv)) != 0) {
zend_hash_copy(
zend_std_get_properties(&object_copy), Z_ARRVAL_P(zv),
zend_std_get_properties(object), Z_ARRVAL_P(zv),
(copy_ctor_func_t) zval_add_ref
);
}
@@ -1,14 +0,0 @@
--TEST--
Unserialize GMP instance with internal reference to itself
--FILE--
<?php
$s = 'C:3:"GMP":23:{s:1:"2";a:1:{i:46;R:1;}}';
var_dump(unserialize($s));
?>
--EXPECT--
object(GMP)#1 (2) {
[46]=>
*RECURSION*
["num"]=>
string(1) "2"
}
+1 -1
View File
@@ -261,7 +261,7 @@ static zend_object *Calendar_object_create(zend_class_entry *ce)
intern = (Calendar_object*)ecalloc(1, sizeof(Calendar_object) + sizeof(zval) * (ce->default_properties_count - 1));
zend_object_std_init(&intern->zo, ce);
object_properties_init(&intern->zo, ce);
object_properties_init((zend_object*) intern, ce);
calendar_object_init(intern);
+4 -1
View File
@@ -158,12 +158,15 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
len = uidna_nameToUnicodeUTF8(uts46, domain, domain_len,
ZSTR_VAL(buffer), buffer_capac, &info, &status);
}
if (len >= 255 || php_intl_idn_check_status(status, "failed to convert name",
if (php_intl_idn_check_status(status, "failed to convert name",
mode) == FAILURE) {
uidna_close(uts46);
zend_string_free(buffer);
RETURN_FALSE;
}
if (len >= 255) {
php_error_docref(NULL, E_ERROR, "ICU returned an unexpected length");
}
ZSTR_VAL(buffer)[len] = '\0';
ZSTR_LEN(buffer) = len;
-37
View File
@@ -1,37 +0,0 @@
--TEST--
Bug #72506 (idn_to_ascii with INTL_IDNA_VARIANT_UTS46 fatals for long domain names)
--DESCRIPTION--
Actually, the $info array should be populated for these cases, but at least it's
not clear yet with which values exactly.
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip this test requires ext/intl');
if (!defined('INTL_IDNA_VARIANT_UTS46')) die('skip no UTS #46 API');
?>
--FILE--
<?php
// ASCII domain name with 255 characters
$domain = str_repeat('a.', 126) . 'aaa';
$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
var_dump($result, $info);
// ASCII domain name with 256 characters – one character added
$domain .= 'a';
$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
var_dump($result, $info);
// International domain name with cyrillic "ф" characters
$domain = str_repeat('ф.', 32) . 'a';
$result = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46, $info);
var_dump($result, $info);
?>
--EXPECT--
bool(false)
array(0) {
}
bool(false)
array(0) {
}
bool(false)
array(0) {
}
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property)
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
class A extends IntlCalendar {
public function __construct() {}
private $a;
}
var_dump(new A());
?>
--EXPECTF--
object(A)#%d (1) {
["valid"]=>
bool(false)
}
@@ -23,7 +23,7 @@ echo "\n";
$timeMillis = $cal->getTime();
$time = time();
var_dump(abs($timeMillis - $time * 1000) < 2000);
var_dump(abs($timeMillis - $time * 1000) < 1000);
?>
==DONE==
+2 -2
View File
@@ -13,11 +13,11 @@ $now = IntlCalendar::getNow();
$proc_now = intlcal_get_now();
$time = time();
var_dump(abs($now - $proc_now) < 500);
var_dump(abs($time * 1000 - $proc_now) < 2000);
var_dump(abs($time * 1000 - $proc_now) < 1000);
?>
==DONE==
--EXPECT--
bool(true)
bool(true)
==DONE==
==DONE==
+1 -1
View File
@@ -1278,8 +1278,8 @@ PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object)
efree(object->document->doc_props);
}
efree(object->document);
object->document = NULL;
}
object->document = NULL;
}
return ret_refcount;
+6 -3
View File
@@ -454,7 +454,7 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl
rc = zend_hash_str_find_ptr(&MBREX(ht_rc), (char *)pattern, patlen);
if (!rc || rc->options != options || rc->enc != enc || rc->syntax != syntax) {
if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
onig_error_code_to_str(err_str, err_code, &err_info);
onig_error_code_to_str(err_str, err_code, err_info);
php_error_docref(NULL, E_WARNING, "mbregex compile err: %s", err_str);
retval = NULL;
goto out;
@@ -1246,6 +1246,9 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
php_error_docref(NULL, E_WARNING, "mbregex search failure in mbregex_search(): %s", err_str);
RETVAL_FALSE;
} else {
if (MBREX(search_regs)->beg[0] == MBREX(search_regs)->end[0]) {
php_error_docref(NULL, E_WARNING, "Empty regular expression");
}
switch (mode) {
case 1:
array_init(return_value);
@@ -1272,7 +1275,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
break;
}
end = MBREX(search_regs)->end[0];
if (pos <= end) {
if (pos < end) {
MBREX(search_pos) = end;
} else {
MBREX(search_pos) = pos + 1;
@@ -1408,7 +1411,7 @@ PHP_FUNCTION(mb_ereg_search_setpos)
return;
}
if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position > Z_STRLEN(MBREX(search_str)))) {
if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && (size_t)position >= Z_STRLEN(MBREX(search_str)))) {
php_error_docref(NULL, E_WARNING, "Position is out of range");
MBREX(search_pos) = 0;
RETURN_FALSE;
-48
View File
@@ -1,48 +0,0 @@
--TEST--
Bug #72691 (mb_ereg_search raises a warning if a match zero-width)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip ext/mbstring required');
?>
--FILE--
<?php
$str = 'foo';
mb_ereg_search_init($str);
mb_ereg_search('\A');
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
mb_ereg_search('\s*');
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
mb_ereg_search('\w+');
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
mb_ereg_search('\Z');
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
?>
--EXPECT--
int(0)
array(1) {
[0]=>
string(0) ""
}
int(0)
array(1) {
[0]=>
string(0) ""
}
int(3)
array(1) {
[0]=>
string(3) "foo"
}
int(3)
array(1) {
[0]=>
string(0) ""
}
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Bug #72693 (mb_ereg_search increments search position when a match zero-width)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip ext/mbstring required');
?>
--FILE--
<?php
mb_ereg_search_init('foo');
var_dump(mb_ereg_search('\A'));
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\s*'));
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\w+'));
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
var_dump(mb_ereg_search('\s*'));
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\Z'));
var_dump(mb_ereg_search_getpos());
?>
--EXPECT--
bool(true)
int(0)
bool(true)
int(0)
bool(true)
int(3)
array(1) {
[0]=>
string(3) "foo"
}
bool(true)
int(3)
bool(true)
int(3)
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #72694 (mb_ereg_search_setpos does not accept a string's last position)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip ext/mbstring required');
?>
--FILE--
<?php
mb_ereg_search_init('foo');
var_dump(mb_ereg_search_setpos(3));
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\Z'));
var_dump(mb_ereg_search_getpos());
?>
--EXPECT--
bool(true)
int(3)
bool(true)
int(3)
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #72710 (`mb_ereg` causes buffer overflow on regexp compile error)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip ext/mbstring required');
?>
--FILE--
<?php
mb_ereg('(?<0>a)', 'a');
?>
--EXPECTF--
Warning: mb_ereg(): mbregex compile err: invalid group name <0> in %s on line %d
+8 -8
View File
@@ -633,10 +633,6 @@ PHP_FUNCTION(mcrypt_generic)
RETURN_FALSE
}
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
/* Check blocksize */
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
block_size = mcrypt_enc_get_block_size(pm->td);
@@ -649,6 +645,10 @@ PHP_FUNCTION(mcrypt_generic)
memset(ZSTR_VAL(data_str), 0, data_size);
memcpy(ZSTR_VAL(data_str), data, data_len);
} else { /* It's not a block algorithm */
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
data_size = (int)data_len;
data_str = zend_string_alloc(data_size, 0);
memset(ZSTR_VAL(data_str), 0, data_size);
@@ -688,10 +688,6 @@ PHP_FUNCTION(mdecrypt_generic)
}
/* Check blocksize */
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
block_size = mcrypt_enc_get_block_size(pm->td);
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
@@ -703,6 +699,10 @@ PHP_FUNCTION(mdecrypt_generic)
memset(data_s, 0, data_size);
memcpy(data_s, data, data_len);
} else { /* It's not a block algorithm */
if (data_len > INT_MAX) {
php_error_docref(NULL, E_WARNING, "Data size too large, %d maximum", INT_MAX);
RETURN_FALSE;
}
data_size = (int)data_len;
data_s = emalloc(data_size + 1);
memset(data_s, 0, data_size);
+1 -1
View File
@@ -63,7 +63,7 @@ echo "Done\n";
?>
--EXPECTF--
Warning: oci_execute(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_003_PKG", line %d
ORA-06512: at "SYSTEM.ARRAY_BIND_003_PKG", line %d
ORA-06512: at line %d in %sarray_bind_003.php on line %d
array(4) {
[0]=>
+1 -1
View File
@@ -63,7 +63,7 @@ echo "Done\n";
?>
--EXPECTF--
Warning: oci_execute(): ORA-01403: %s
ORA-06512: at "%s.ARRAY_BIND_004_PKG", line %d
ORA-06512: at "SYSTEM.ARRAY_BIND_004_PKG", line %d
ORA-06512: at line %d in %sarray_bind_004.php on line %d
array(0) {
}
+1 -1
View File
@@ -57,5 +57,5 @@ Test 1
Warning: oci_execute(): ORA-29478: %s
ORA-06512: at "SYS.DBMS_SQL", line %d
ORA-06512: at "SYS.DBMS_SQL", line %d
ORA-06512: at "%s.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d
ORA-06512: at "SYSTEM.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d
===DONE===
+1 -1
View File
@@ -157,7 +157,7 @@ echo "Done\n";
------Test 1 - Set Prefetch after PL/SQL fetch ----------
Warning: oci_execute(): ORA-01001: %s
ORA-06512: at "%s.REFCURPKG", line %d
ORA-06512: at "SYSTEM.REFCURPKG", line %d
ORA-06512: at line %d in %s on line %d
Fetch Row from PL/SQL
int(0)
+2 -2
View File
@@ -625,7 +625,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
ZCSG(force_restart_time) = 0;
while (mem_usage_check->l_pid > 0) {
while (tries--) {
zend_accel_error(ACCEL_LOG_WARNING, "Killed locker %d", mem_usage_check->l_pid);
zend_accel_error(ACCEL_LOG_ERROR, "Killed locker %d", mem_usage_check->l_pid);
if (kill(mem_usage_check->l_pid, SIGKILL)) {
break;
}
@@ -638,7 +638,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
usleep(10000);
}
if (!tries) {
zend_accel_error(ACCEL_LOG_WARNING, "Can't kill %d after 10 tries!", mem_usage_check->l_pid);
zend_accel_error(ACCEL_LOG_ERROR, "Can't kill %d after 20 tries!", mem_usage_check->l_pid);
ZCSG(force_restart_time) = time(NULL); /* restore forced restart request */
}
+1 -1
View File
@@ -261,7 +261,7 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce)
subpat_names = (char **)ecalloc(num_subpats, sizeof(char *));
while (ni++ < name_cnt) {
name_idx = 0x100 * (unsigned char)name_table[0] + (unsigned char)name_table[1];
name_idx = 0xff * (unsigned char)name_table[0] + (unsigned char)name_table[1];
subpat_names[name_idx] = name_table + 2;
if (is_numeric_string(subpat_names[name_idx], strlen(subpat_names[name_idx]), NULL, NULL, 0) > 0) {
php_error_docref(NULL, E_WARNING, "Numeric named subpatterns are not allowed");
+6 -8
View File
@@ -1,16 +1,14 @@
--TEST--
Bug #72463 mail fails with invalid argument
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) == "WIN") {
die('skip not for windows');
}
?>
--INI--
sendmail_path="echo >/dev/null"
--FILE--
<?php
if(substr(PHP_OS, 0, 3) == "WIN") {
ini_set("smtp", "non.existent.smtp.server");
} else {
ini_set("sendmail_path", "echo hello >/dev/null");
}
mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a", "");
mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a", NULL);
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #72463 mail fails with invalid argument
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) != "WIN") {
die('skip windows only');
}
?>
--INI--
SMTP=non.existent.smtp.server
--FILE--
<?php
mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a", "");
mail("some.address.it.wont.ever.reach@lookup.and.try.to.find.this.host.name","subject","a", NULL);
?>
===DONE===
--EXPECTREGEX--
.*===DONE===
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #72688 (preg_match missing group names in matches)
--FILE--
<?php
$pattern = [];
for ($i = 0; $i < 300; $i++) {
$pattern[] = "(?'group{$i}'{$i}$)";
}
$fullPattern = '/' . implode('|', $pattern) . '/uix';
preg_match($fullPattern, '290', $matches);
var_dump($matches['group290']);
?>
--EXPECT--
string(3) "290"
+4 -4
View File
@@ -2129,10 +2129,10 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
}
php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
param->paramno, param->name ? ZSTR_LEN(param->name) : 0, param->name ? (int) ZSTR_LEN(param->name) : 0,
param->name ? ZSTR_VAL(param->name) : "",
param->is_param,
param->param_type);
param->paramno, param->name ? ZSTR_LEN(param->name) : 0, param->name ? (int) ZSTR_LEN(param->name) : 0,
param->name ? ZSTR_VAL(param->name) : "",
param->is_param,
param->param_type);
} ZEND_HASH_FOREACH_END();
}
+1 -1
View File
@@ -148,7 +148,7 @@ static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unqu
int useBinaryEncoding = 0;
const char * hex = "0123456789abcdef";
size_t i;
int i;
char * q;
*quotedlen = 0;
+6 -6
View File
@@ -19,16 +19,16 @@ array(1) {
[0]=>
array(6) {
["computed"]=>
int(1)
string(1) "1"
[0]=>
int(1)
string(1) "1"
["named"]=>
int(2)
string(1) "2"
[1]=>
int(2)
string(1) "2"
["computed1"]=>
int(3)
string(1) "3"
[2]=>
int(3)
string(1) "3"
}
}
+1 -1
View File
@@ -307,7 +307,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
case PDO_PARAM_EVT_EXEC_PRE:
if (!stmt->bound_param_map) {
return 1;
return 0;
}
if (!S->param_values) {
S->param_values = ecalloc(
-37
View File
@@ -1,37 +0,0 @@
--TEST--
PDO PgSQL Bug #70313 (PDO statement fails to throw exception)
--SKIPIF--
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
require dirname(__FILE__) . '/config.inc';
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
try {
$stmt = $db->prepare(");");
$stmt->execute([1]);
} catch (PDOException $e) {
var_dump($e->getCode());
}
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
try {
$stmt = $db->prepare(");");
$stmt->execute([1]);
} catch (PDOException $e) {
var_dump($e->getCode());
}
?>
--EXPECT--
string(5) "42601"
string(5) "42601"
+1 -1
View File
@@ -25,4 +25,4 @@ try {
?>
--EXPECT--
string(5) "08P01"
bool(false)
+1 -1
View File
@@ -5,7 +5,7 @@
// environment var PGSQL_TEST_CONNSTR
// "test" database must exist. i.e. "createdb test" before testing
$conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432 user=postgres password=postgres"; // connection string
$conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432"; // connection string
$table_name = "php_pgsql_test"; // test table that will be created
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
+5 -9
View File
@@ -618,16 +618,12 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
static void _const_string(string *str, char *name, zval *value, char *indent)
{
char *type = zend_zval_type_name(value);
zend_string *value_str = zval_get_string(value);
if (Z_TYPE_P(value) == IS_ARRAY) {
string_printf(str, "%s Constant [ %s %s ] { Array }\n",
indent, type, name);
} else {
zend_string *value_str = zval_get_string(value);
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
indent, type, name, ZSTR_VAL(value_str));
zend_string_release(value_str);
}
string_printf(str, "%s Constant [ %s %s ] { %s }\n",
indent, type, name, ZSTR_VAL(value_str));
zend_string_release(value_str);
}
/* }}} */
@@ -1,31 +0,0 @@
--TEST--
ReflectionClass::export() - array constants
--FILE--
<?php
Class A {
const A = 8;
const B = ["a", "b"];
}
ReflectionClass::export("A");
?>
--EXPECTF--
Class [ <user> class A ] {
@@ %s 2-5
- Constants [2] {
Constant [ integer A ] { 8 }
Constant [ array B ] { Array }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [0] {
}
}
+8 -23
View File
@@ -905,19 +905,12 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
const char *endptr = val + vallen;
zval session_vars;
php_unserialize_data_t var_hash;
int result;
zend_string *var_name = zend_string_init("_SESSION", sizeof("_SESSION") - 1, 0);
ZVAL_NULL(&session_vars);
PHP_VAR_UNSERIALIZE_INIT(var_hash);
result = php_var_unserialize(
&session_vars, (const unsigned char **)&val, (const unsigned char *)endptr, &var_hash);
php_var_unserialize(&session_vars, (const unsigned char **)&val, (const unsigned char *)endptr, &var_hash);
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
if (!result) {
zval_ptr_dtor(&session_vars);
ZVAL_NULL(&session_vars);
}
if (!Z_ISUNDEF(PS(http_session_vars))) {
zval_ptr_dtor(&PS(http_session_vars));
}
@@ -970,13 +963,11 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
int namelen;
zend_string *name;
php_unserialize_data_t var_hash;
int skip = 0;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
for (p = val; p < endptr; ) {
zval *tmp;
skip = 0;
namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF);
if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) {
@@ -993,7 +984,8 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
if ((tmp = zend_hash_find(&EG(symbol_table), name))) {
if ((Z_TYPE_P(tmp) == IS_ARRAY &&
Z_ARRVAL_P(tmp) == &EG(symbol_table)) || tmp == &PS(http_session_vars)) {
skip = 1;
zend_string_release(name);
continue;
}
}
@@ -1002,9 +994,7 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */
current = var_tmp_var(&var_hash);
if (php_var_unserialize(current, (const unsigned char **) &p, (const unsigned char *) endptr, &var_hash)) {
ZVAL_PTR(&rv, current);
if (!skip) {
php_set_session_var(name, &rv, &var_hash);
}
php_set_session_var(name, &rv, &var_hash );
} else {
zend_string_release(name);
php_session_normalize_vars();
@@ -1066,7 +1056,6 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
zend_string *name;
int has_value, retval = SUCCESS;
php_unserialize_data_t var_hash;
int skip = 0;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
@@ -1075,7 +1064,6 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
while (p < endptr) {
zval *tmp;
q = p;
skip = 0;
while (*q != PS_DELIMITER) {
if (++q >= endptr) goto break_outer_loop;
}
@@ -1093,7 +1081,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
if ((tmp = zend_hash_find(&EG(symbol_table), name))) {
if ((Z_TYPE_P(tmp) == IS_ARRAY &&
Z_ARRVAL_P(tmp) == &EG(symbol_table)) || tmp == &PS(http_session_vars)) {
skip = 1;
goto skip;
}
}
@@ -1102,19 +1090,16 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */
current = var_tmp_var(&var_hash);
if (php_var_unserialize(current, (const unsigned char **)&q, (const unsigned char *)endptr, &var_hash)) {
ZVAL_PTR(&rv, current);
if (!skip) {
php_set_session_var(name, &rv, &var_hash);
}
php_set_session_var(name, &rv, &var_hash);
} else {
zend_string_release(name);
retval = FAILURE;
goto break_outer_loop;
}
} else {
if(!skip) {
PS_ADD_VARL(name);
}
PS_ADD_VARL(name);
}
skip:
zend_string_release(name);
p = q;
+3 -3
View File
@@ -36,9 +36,9 @@ function ptr2str($ptr)
}
?>
--EXPECTF--
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%ebug72562.php on line %d
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s/bug72562.php on line %d
Notice: unserialize(): Error at offset 0 of 1 bytes in %s%ebug72562.php on line %d
Notice: unserialize(): Error at offset 0 of 1 bytes in %s/bug72562.php on line %d
Notice: unserialize(): Error at offset 4 of 4 bytes in %s%ebug72562.php on line %d
Notice: unserialize(): Error at offset 4 of 4 bytes in %s/bug72562.php on line %d
bool(false)
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Bug #72681: PHP Session Data Injection Vulnerability
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
ini_set('session.serialize_handler', 'php');
session_start();
$GLOBALS['ryat'] = $GLOBALS;
$_SESSION['ryat'] = 'ryat|O:8:"stdClass":0:{}';
session_write_close();
session_start();
var_dump($_SESSION);
?>
--EXPECT--
array(0) {
}
@@ -4,7 +4,6 @@ Test session_set_save_handler() function : test lazy_write
session.lazy_write=1
session.save_path=
session.name=PHPSESSID
session.gc_probability=0
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
+26 -40
View File
@@ -244,29 +244,22 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
sxe = Z_SXEOBJ_P(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
if (!member || Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
} else if (!member) {
/* This happens when the user did: $sxe[]->foo = $value */
php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute");
return NULL;
}
goto long_dim;
name = NULL;
} else {
ZVAL_DEREF(member);
if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
long_dim:
attribs = 0;
elements = 1;
}
name = NULL;
} else {
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_STR(&tmp_zv, zval_get_string(member));
member = &tmp_zv;
}
name = Z_STRVAL_P(member);
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_STR(&tmp_zv, zval_get_string(member));
member = &tmp_zv;
}
name = Z_STRVAL_P(member);
}
GET_NODE(sxe, node);
@@ -457,8 +450,11 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
sxe = Z_SXEOBJ_P(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
if (!member || Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
} else if (!member) {
/* This happens when the user did: $sxe[] = $value
* and could also be E_PARSE, but we use this only during parsing
* and this is during runtime.
@@ -466,30 +462,20 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute");
return FAILURE;
}
goto long_dim;
} else {
ZVAL_DEREF(member);
if (Z_TYPE_P(member) == IS_LONG) {
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
long_dim:
attribs = 0;
elements = 1;
}
} else {
if (Z_TYPE_P(member) != IS_STRING) {
trim_str = zval_get_string(member);
ZVAL_STR(&tmp_zv, php_trim(trim_str, NULL, 0, 3));
zend_string_release(trim_str);
member = &tmp_zv;
}
if (Z_TYPE_P(member) != IS_STRING) {
trim_str = zval_get_string(member);
ZVAL_STR(&tmp_zv, php_trim(trim_str, NULL, 0, 3));
zend_string_release(trim_str);
member = &tmp_zv;
}
if (!Z_STRLEN_P(member)) {
php_error_docref(NULL, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
if (member == &tmp_zv) {
zval_dtor(&tmp_zv);
}
return FAILURE;
if (!Z_STRLEN_P(member)) {
php_error_docref(NULL, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
if (member == &tmp_zv) {
zval_dtor(&tmp_zv);
}
return FAILURE;
}
}
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Bug #72588 (Using global var doesn't work while accessing SimpleXML element)
--SKIPIF--
<?php
if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
?>
--FILE--
<?php
$tpnb = 5;
$dummy = &$tpnb;
$xmlStruct = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<object type="obj_1" label="Label for object 1"></object>
<object type="obj_2" label="Label for object 2"></object>
<object type="obj_3" label="Label for object 3"></object>
<object type="obj_4" label="Label for object 4"></object>
<object type="obj_5" label="Label for object 5"></object>
<object type="obj_6" label="Label for object 6"></object>
<object type="obj_7" label="Label for object 7"></object>
<object type="obj_8" label="Label for object 8"></object>
<object type="obj_9" label="Label for object 9"></object>
<object type="obj_10" label="Label for object 10"></object>
</templates>
EOF;
$tplxml = simplexml_load_string($xmlStruct);
var_dump($tplxml->object[$tpnb]);
?>
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
["@attributes"]=>
array(2) {
["type"]=>
string(5) "obj_6"
["label"]=>
string(18) "Label for object 6"
}
}
+1 -1
View File
@@ -1011,7 +1011,7 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
php_error_docref(NULL, E_WARNING, "Got empty OID array");
return FALSE;
}
objid_query->vars = (snmpobjarg *)safe_emalloc(sizeof(snmpobjarg), zend_hash_num_elements(Z_ARRVAL_P(oid)), 0);
objid_query->vars = (snmpobjarg *)emalloc(sizeof(snmpobjarg) * zend_hash_num_elements(Z_ARRVAL_P(oid)));
if (objid_query->vars == NULL) {
php_error_docref(NULL, E_WARNING, "emalloc() failed while parsing oid array: %s", strerror(errno));
efree(objid_query->vars);
@@ -8,9 +8,6 @@ die('skip sockets extension not available.');
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
die('skip not for Microsoft Windows');
}
if (strtolower(substr(PHP_OS, 0, 3)) == 'aix') {
die('skip not for AIX');
}
--CLEAN--
<?php
$path = __DIR__ . "/unix_sock";
@@ -8,9 +8,6 @@ die('skip sockets extension not available.');
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
die('skip not for Microsoft Windows');
}
if (strtolower(substr(PHP_OS, 0, 3)) == 'aix') {
die('skip not for AIX');
}
--CLEAN--
<?php
$path = __DIR__ . "/unix_sock";
+4 -7
View File
@@ -657,7 +657,7 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend
{
spl_filesystem_object *fsobj = spl_filesystem_from_obj(*object);
if (fsobj->u.dir.dirp == NULL && fsobj->orig_path == NULL) {
if (fsobj->u.dir.entry.d_name[0] == '\0' && fsobj->orig_path == NULL) {
zend_function *func;
zend_string *tmp = zend_string_init("_bad_state_ex", sizeof("_bad_state_ex") - 1, 0);
func = zend_get_std_object_handlers()->get_method(object, tmp, NULL);
@@ -2657,7 +2657,7 @@ SPL_METHOD(SplFileObject, fputcsv)
/* }}} */
/* {{{ proto void SplFileObject::setCsvControl([string delimiter [, string enclosure [, string escape ]]])
Set the delimiter, enclosure and escape character used in fgetcsv */
Set the delimiter and enclosure character used in fgetcsv */
SPL_METHOD(SplFileObject, setCsvControl)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
@@ -2700,11 +2700,11 @@ SPL_METHOD(SplFileObject, setCsvControl)
/* }}} */
/* {{{ proto array SplFileObject::getCsvControl()
Get the delimiter, enclosure and escape character used in fgetcsv */
Get the delimiter and enclosure character used in fgetcsv */
SPL_METHOD(SplFileObject, getCsvControl)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis());
char delimiter[2], enclosure[2], escape[2];
char delimiter[2], enclosure[2];
array_init(return_value);
@@ -2712,12 +2712,9 @@ SPL_METHOD(SplFileObject, getCsvControl)
delimiter[1] = '\0';
enclosure[0] = intern->u.file.enclosure;
enclosure[1] = '\0';
escape[0] = intern->u.file.escape;
escape[1] = '\0';
add_next_index_string(return_value, delimiter);
add_next_index_string(return_value, enclosure);
add_next_index_string(return_value, escape);
}
/* }}} */
+1 -1
View File
@@ -1679,7 +1679,7 @@ static inline void spl_dual_it_rewind(spl_dual_it_object *intern)
{
spl_dual_it_free(intern);
intern->current.pos = 0;
if (intern->inner.iterator && intern->inner.iterator->funcs->rewind) {
if (intern->inner.iterator->funcs->rewind) {
intern->inner.iterator->funcs->rewind(intern->inner.iterator);
}
}
@@ -6,12 +6,10 @@ $obj = New SplFileObject(dirname(__FILE__).'/SplFileObject_testinput.csv');
var_dump($obj->getCsvControl());
?>
--EXPECT--
array(3) {
--EXPECTF--
array(2) {
[0]=>
string(1) ","
%unicode|string%(1) ","
[1]=>
string(1) """
[2]=>
string(1) "\"
%unicode|string%(1) """
}
-337
View File
@@ -1,337 +0,0 @@
--TEST--
Bug #55701 (GlobIterator throws LogicException with message 'The parent constructor was not called')
--FILE--
<?php
//
// Some methods of GlobIterator do not throw a RuntimeException when the glob pattern doesn't match any file.
// Most methods of GlobIterator throw a RuntimeException when the glob pattern does't match any file
// because they get the properties of the current file
function testBaseClass($f) {
// The tested iterator is in an invalid state; the behaviour of most of its methods is undefined
try {
$f();
echo "ran normally (expected)\n";
} catch (RuntimeException $e) {
// Throwing a RuntimeException is the correct behaviour for some methods
echo "ran normally (expected)\n";
} catch (LogicException $e) {
// Throwing a LogicException is not correct
echo "threw LogicException (unexpected)\n";
}
}
//
// The derived classes must throw LogicException if the parent class constructor was not called
function testChildClass($f) {
try {
$f();
echo "didn't throw (unexpected)\n";
} catch (LogicException $e) {
echo "threw LogicException (expected)\n";
} catch (Exception $e) {
echo "threw other exception (unexpected)\n";
}
}
//
// It must not throw LogicException when the iterator is not valid
echo "->count()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->count();
} );
echo "->rewind()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->rewind();
} );
echo "->getFlags()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getFlags();
} );
echo "->setFlags()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->setFlags(FilesystemIterator::KEY_AS_PATHNAME);
} );
echo "->valid()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->valid();
} );
//
// When the iterator is not valid, the behaviour of the next methods is undefined
// Some of them throw a RuntimeException while others just return an invalid value
// However, they must not throw LogicException
echo "->current()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->current();
} );
echo "->key()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->key();
} );
echo "->next()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->next();
} );
echo "->getATime()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getATime();
} );
echo "->getBasename()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getBasename();
} );
echo "->getCTime()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getCTime();
} );
echo "->getExtension()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getExtension();
} );
echo "->getFilename()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getFilename();
} );
echo "->getGroup()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getGroup();
} );
echo "->getInode()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getInode();
} );
echo "->getMTime()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getMTime();
} );
echo "->getOwner()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getOwner();
} );
echo "->getPath()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getPath();
} );
echo "->getPathname()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getPathname();
} );
echo "->getPerms()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getPerms();
} );
echo "->getSize()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getSize();
} );
echo "->getType()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->getType();
} );
echo "->isDir()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isDir();
} );
echo "->isDot()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isDot();
} );
echo "->isExecutable()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isExecutable();
} );
echo "->isFile()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isFile();
} );
echo "->isLink()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isLink();
} );
echo "->isReadable()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isReadable();
} );
echo "->isWritable()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->isWritable();
} );
echo "->seek()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->seek(0);
} );
echo "->__toString()... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.abcdefghij');
$o->__toString();
} );
//
// Supplemental test: no method should throw LogicException if it is invoked
// after a successful iteration over a non-empty list of files.
echo "non-empty GlobIterator... ";
testBaseClass( function() {
$o = new GlobIterator(__DIR__.'/*.phpt');
foreach ($o as $file) {
// nothing here, just consume all the items
}
// This must not throw an exception
$o->count();
} );
//
// The correct existing behaviour must not change
// The classes SplFileObject and SplTempFileObject are not affected by the bug
echo "======================= test there are no regressions =======================\n";
echo "SplFileObject existent file... ";
testBaseClass( function() {
$o = new SplFileObject(__FILE__);
$o->fread(1);
} );
echo "SplFileObject non-existent file... ";
testBaseClass( function() {
$o = new SplFileObject('/tmp/abcdefghij.abcdefghij');
$o->fread(1);
} );
//
// Check that when derived classes do not call GlobIterator::__construct()
// the LogicException is thrown (don't break the behaviour introduced to fix bug #54384)
echo "extends GlobIterator... ";
class GlobIteratorChild extends GlobIterator {
public function __construct() {}
}
testChildClass( function() {
$o = new GlobIteratorChild();
$o->count();
} );
echo "extends SplFileObject... ";
class SplFileObjectChild extends SplFileObject {
public function __construct() {}
}
testChildClass( function() {
$o = new SplFileObjectChild();
$o->count();
} );
echo "extends SplTempFileObject... ";
class SplTempFileObjectChild extends SplTempFileObject {
public function __construct() {}
}
testChildClass( function() {
$o = new SplTempFileObjectChild();
$o->count();
} );
--EXPECT--
->count()... ran normally (expected)
->rewind()... ran normally (expected)
->getFlags()... ran normally (expected)
->setFlags()... ran normally (expected)
->valid()... ran normally (expected)
->current()... ran normally (expected)
->key()... ran normally (expected)
->next()... ran normally (expected)
->getATime()... ran normally (expected)
->getBasename()... ran normally (expected)
->getCTime()... ran normally (expected)
->getExtension()... ran normally (expected)
->getFilename()... ran normally (expected)
->getGroup()... ran normally (expected)
->getInode()... ran normally (expected)
->getMTime()... ran normally (expected)
->getOwner()... ran normally (expected)
->getPath()... ran normally (expected)
->getPathname()... ran normally (expected)
->getPerms()... ran normally (expected)
->getSize()... ran normally (expected)
->getType()... ran normally (expected)
->isDir()... ran normally (expected)
->isDot()... ran normally (expected)
->isExecutable()... ran normally (expected)
->isFile()... ran normally (expected)
->isLink()... ran normally (expected)
->isReadable()... ran normally (expected)
->isWritable()... ran normally (expected)
->seek()... ran normally (expected)
->__toString()... ran normally (expected)
non-empty GlobIterator... ran normally (expected)
======================= test there are no regressions =======================
SplFileObject existent file... ran normally (expected)
SplFileObject non-existent file... ran normally (expected)
extends GlobIterator... threw LogicException (expected)
extends SplFileObject... threw LogicException (expected)
extends SplTempFileObject... threw LogicException (expected)
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #72684 (AppendIterator segfault with closed generator)
--FILE--
<?php
function createGenerator() { yield 1; }
$generator = createGenerator();
$appendIterator = new AppendIterator();
$appendIterator->append($generator);
iterator_to_array($appendIterator);
try {
iterator_to_array($appendIterator);
} catch (\Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Cannot traverse an already closed generator
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff. Show more