com php-src: Fixed bug #74852 (property_exists returns true on unknown DateInterval property): NEWS ex t/date/php_date.c ext/date/tests/bug74852.php
t

From: Date: Mon, 10 Jul 2017 05:53:22 +0000
Subject: com php-src: Fixed bug #74852 (property_exists returns true on unknown DateInterval property): NEWS ex t/date/php_date.c ext/date/tests/bug74852.php
t
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98478@lists.php.net to get a copy of this message
Commit: 5cf54f6073f9e3cfc99eca9e8a5706a08dd404a1 Author: jhdxr <jhdxr@php.net> Sat, 8 Jul 2017 20:04:25 +0800 Committer: Joe Watkins <krakjoe@php.net> Mon, 10 Jul 2017 06:53:22 +0100 Parents: 62700f76cbf3840bf310faa599e41d300a4aaaf0 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5cf54f6073f9e3cfc99eca9e8a5706a08dd404a1 Log: Fixed bug #74852 (property_exists returns true on unknown DateInterval property) Bugs: https://bugs.php.net/74852 Changed paths: M NEWS M ext/date/php_date..c A ext/date/tests/bug74852.phpt Diff: diff --git a/NEWS b/NEWS index 7c2bfe8..be13bad 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ PHP NEWS . Fixed bug #74761 (Unary operator expected error on some systems). (petk) . Fixed bug #73900 (Use After Free in unserialize() SplFixedArray). (nikic) +- Date: + . Fixed bug #74852 (property_exists returns true on unknown DateInterval + property). (jhdxr) + - OCI8: . Fixed bug #74625 (Integer overflow in oci_bind_array_by_name). (Ingmar Runge) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 7383682..f671f4c 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1986,7 +1986,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void zval *prop; int retval = 0; - if (Z_TYPE_P(member) != IS_STRING) { + if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { ZVAL_COPY(&tmp_member, member); convert_to_string(&tmp_member); member = &tmp_member; @@ -2002,10 +2002,10 @@ static int date_interval_has_property(zval *object, zval *member, int type, void } return retval; } - - prop = date_interval_read_property(object, member, type, cache_slot, &rv); - - if (prop != NULL) { + + prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + + if (prop != &EG(uninitialized_zval)) { if (type == 2) { retval = 1; } else if (type == 1) { diff --git a/ext/date/tests/bug74852.phpt b/ext/date/tests/bug74852.phpt new file mode 100644 index 0000000..e293bef --- /dev/null +++ b/ext/date/tests/bug74852.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #74852 property_exists returns true on unknown DateInterval property +--FILE-- +<?php + +$interval = new DateInterval('P2D'); +var_dump(property_exists($interval,'abcde')); +var_dump(isset($interval->abcde)); +var_dump($interval->abcde); + +?> +--EXPECTF-- +bool(false) +bool(false) + +Notice: Undefined property: DateInterval::$abcde in %s on line %d +NULL

« previous php.cvs (#98478) next »