Browse Source

Fixed bug #74852 (property_exists returns true on unknown DateInterval property)

pull/2620/merge
jhdxr 8 years ago
committed by Joe Watkins
parent
commit
5cf54f6073
No known key found for this signature in database GPG Key ID: F9BA0ADA31CBD89E
  1. 4
      NEWS
  2. 10
      ext/date/php_date.c
  3. 17
      ext/date/tests/bug74852.phpt

4
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)

10
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) {

17
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
Loading…
Cancel
Save