diff options
-rw-r--r-- | Zend/zend_execute.c | 14 | ||||
-rw-r--r-- | ext/date/tests/DateTimeZone_getLocation.phpt | 19 | ||||
-rw-r--r-- | ext/simplexml/tests/017.phpt | 21 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug72433.phpt | 17 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug72663.phpt | 4 | ||||
-rw-r--r-- | sapi/fpm/tests/fcgi.inc | 6 |
6 files changed, 26 insertions, 55 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index bbe83240e6..43b172a307 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2274,7 +2274,7 @@ static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_UNSET(z zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET EXECUTE_DATA_CC); } -static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int support_strings, int slow EXECUTE_DATA_DC) +static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type, int is_list, int slow EXECUTE_DATA_DC) { zval *retval; @@ -2291,7 +2291,7 @@ try_array: } } } - if (support_strings && EXPECTED(Z_TYPE_P(container) == IS_STRING)) { + if (!is_list && EXPECTED(Z_TYPE_P(container) == IS_STRING)) { zend_long offset; try_string_offset: @@ -2381,30 +2381,30 @@ try_string_offset: static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_R(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC); } static zend_never_inline void zend_fetch_dimension_address_read_R_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 1, 1 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, IS_CV, BP_VAR_R, 0, 1 EXECUTE_DATA_CC); } static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_read_IS(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 1, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS, 0, 0 EXECUTE_DATA_CC); } static zend_never_inline void ZEND_FASTCALL zend_fetch_dimension_address_LIST_r(zval *container, zval *dim, int dim_type OPLINE_DC EXECUTE_DATA_DC) { zval *result = EX_VAR(opline->result.var); - zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 0, 0 EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R, 1, 0 EXECUTE_DATA_CC); } ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type) { - zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 1, 0 NO_EXECUTE_DATA_CC); + zend_fetch_dimension_address_read(result, container, dim, IS_TMP_VAR, type, 0, 0 NO_EXECUTE_DATA_CC); } static zend_never_inline zval* ZEND_FASTCALL zend_find_array_dim_slow(HashTable *ht, zval *offset EXECUTE_DATA_DC) diff --git a/ext/date/tests/DateTimeZone_getLocation.phpt b/ext/date/tests/DateTimeZone_getLocation.phpt index 06d22820f1..0d9a43f5e7 100644 --- a/ext/date/tests/DateTimeZone_getLocation.phpt +++ b/ext/date/tests/DateTimeZone_getLocation.phpt @@ -1,20 +1,21 @@ --TEST-- -DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone public array DateTimeZone::getLocation ( void ) ; +Test DateTimeZone::getLocation() --CREDITS-- marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --FILE-- <?php -$arrayDate = DateTimeZone::listAbbreviations(); $countryCode = array("??"); $countryCodeTest = array("AU", "CA", "ET", "AF", "US", "KZ", "AM"); -foreach($arrayDate as $value){ - - if(NULL != $value[0]['timezone_id']){ +foreach (DateTimeZone::listAbbreviations() as $value) { + if (NULL != $value[0]['timezone_id']) { $timeZone = new DateTimeZone($value[0]['timezone_id']); $timeZoneArray = $timeZone->getLocation(); + if (false === $timeZoneArray) { + continue; + } - if((!in_array($timeZoneArray['country_code'], $countryCode)) && (NULL != $timeZoneArray['country_code']) && ("" != $timeZoneArray['country_code'])) { + if (!in_array($timeZoneArray['country_code'], $countryCode) && NULL != $timeZoneArray['country_code']) { array_push($countryCode, $timeZoneArray['country_code']); if(in_array($timeZoneArray['country_code'], $countryCodeTest)){ @@ -24,12 +25,6 @@ foreach($arrayDate as $value){ } } ?> ---CLEAN-- -<?php -unset($arrayDate); -unset($countryCode); -unset($countryCodeTest); -?> --EXPECTF-- Array ( diff --git a/ext/simplexml/tests/017.phpt b/ext/simplexml/tests/017.phpt index ba42ac46a9..42d6e3eccc 100644 --- a/ext/simplexml/tests/017.phpt +++ b/ext/simplexml/tests/017.phpt @@ -34,12 +34,11 @@ function print_xml($xml) { } function print_xml2($xml) { - $persons = 2; - for ($i=0;$i<$persons;$i++) { - echo "person: ".$xml->person[$i]['name']."\n"; - $children = 2; - for ($j=0;$j<$children;$j++) { - echo " child: ".$xml->person[$i]->child[$j]['name']."\n"; + for ($i=0;$i<count($xml->person);$i++) { + $person = $xml->person[$i]; + echo "person: ".$person['name']."\n"; + for ($j=0;$j<count($person->child);$j++) { + echo " child: ".$person->child[$j]['name']."\n"; } } } @@ -54,7 +53,7 @@ echo "---22---\n"; print_xml2(simplexml_load_string($xml1)); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- ---11--- person: Joe child: Ann @@ -75,12 +74,4 @@ person: Boe ---22--- person: Joe child: Ann - child: -person: - -Notice: Trying to get property 'child' of non-object in %s017.php on line %d - child: - -Notice: Trying to get property 'child' of non-object in %s017.php on line %d - child: ===DONE=== diff --git a/ext/standard/tests/strings/bug72433.phpt b/ext/standard/tests/strings/bug72433.phpt index 534b1e6ac6..f311022500 100644 --- a/ext/standard/tests/strings/bug72433.phpt +++ b/ext/standard/tests/strings/bug72433.phpt @@ -2,22 +2,9 @@ Bug #72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize --FILE-- <?php -// Fill any potential freed spaces until now. -$filler = array(); -for($i = 0; $i < 100; $i++) - $filler[] = ""; -// Create our payload and unserialize it. $serialized_payload = 'a:3:{i:0;r:1;i:1;r:1;i:2;C:11:"ArrayObject":19:{x:i:0;r:1;;m:a:0:{}}}'; -$free_me = unserialize($serialized_payload); -// We need to increment the reference counter of our ArrayObject s.t. all reference counters of our unserialized array become 0. -$inc_ref_by_one = $free_me[2]; -// The call to gc_collect_cycles will free '$free_me'. -gc_collect_cycles(); -// We now have multiple freed spaces. Fill all of them. -$fill_freed_space_1 = "filler_zval_1"; -$fill_freed_space_2 = "filler_zval_2"; -var_dump($free_me); +var_dump(unserialize($serialized_payload)); ?> --EXPECTF-- -Notice: unserialize(): Error at offset %d of %d bytes in %sbug72433.php on line 8 +Notice: unserialize(): Error at offset %d of %d bytes in %sbug72433.php on line 3 bool(false) diff --git a/ext/standard/tests/strings/bug72663.phpt b/ext/standard/tests/strings/bug72663.phpt index ec16e069ff..c9abd51b08 100644 --- a/ext/standard/tests/strings/bug72663.phpt +++ b/ext/standard/tests/strings/bug72663.phpt @@ -15,8 +15,7 @@ class obj implements Serializable { $inner = 'a:1:{i:0;O:9:"Exception":2:{s:7:"'."\0".'*'."\0".'file";R:4;}'; $exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}'; -$data = unserialize($exploit); -echo $data[1]; +var_dump(unserialize($exploit)); ?> DONE --EXPECTF-- @@ -25,4 +24,5 @@ Notice: unserialize(): Unexpected end of serialized data in %sbug72663.php on li Notice: unserialize(): Error at offset 46 of 47 bytes in %sbug72663.php on line %d Notice: unserialize(): Error at offset 79 of 80 bytes in %sbug72663.php on line %d +bool(false) DONE diff --git a/sapi/fpm/tests/fcgi.inc b/sapi/fpm/tests/fcgi.inc index 7e3ad0514b..f31811aef6 100644 --- a/sapi/fpm/tests/fcgi.inc +++ b/sapi/fpm/tests/fcgi.inc @@ -589,9 +589,7 @@ class Client // but still not get the response requested $startTime = microtime(true); - do { - $resp = $this->readPacket(); - + while ($resp = $this->readPacket()) { if ($resp['type'] == self::STDOUT || $resp['type'] == self::STDERR) { if ($resp['type'] == self::STDERR) { $this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_ERR; @@ -612,7 +610,7 @@ class Client $this->set_ms_timeout($this->_readWriteTimeout); throw new \Exception('Timed out'); } - } while ($resp); + } if (!is_array($resp)) { $info = stream_get_meta_data($this->_sock); |