Make birthday time comparison 32-bit safe in Protocol\DFRN
- Address https://github.com/friendica/friendica/issues/10168#issuecomment-838221234
This commit is contained in:
parent
7789ea2507
commit
aeef4960a1
|
@ -1441,8 +1441,8 @@ class DFRN
|
||||||
/**
|
/**
|
||||||
* Fetch the author data from head or entry items
|
* Fetch the author data from head or entry items
|
||||||
*
|
*
|
||||||
* @param object $xpath XPath object
|
* @param \DOMXPath $xpath XPath object
|
||||||
* @param object $context In which context should the data be searched
|
* @param \DOMNode $context In which context should the data be searched
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param string $element Element name from which the data is fetched
|
* @param string $element Element name from which the data is fetched
|
||||||
* @param bool $onlyfetch Should the data only be fetched or should it update the contact record as well
|
* @param bool $onlyfetch Should the data only be fetched or should it update the contact record as well
|
||||||
|
@ -1453,7 +1453,7 @@ class DFRN
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
* @todo Find good type-hints for all parameter
|
* @todo Find good type-hints for all parameter
|
||||||
*/
|
*/
|
||||||
private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "")
|
private static function fetchauthor(\DOMXPath $xpath, \DOMNode $context, $importer, $element, $onlyfetch, $xml = "")
|
||||||
{
|
{
|
||||||
$author = [];
|
$author = [];
|
||||||
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
|
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
|
||||||
|
@ -1609,12 +1609,14 @@ class DFRN
|
||||||
}
|
}
|
||||||
|
|
||||||
// "dfrn:birthday" contains the birthday converted to UTC
|
// "dfrn:birthday" contains the birthday converted to UTC
|
||||||
$birthday = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
|
$birthday = XML::getFirstNodeValue($xpath, $element . "/dfrn:birthday/text()", $context);
|
||||||
|
try {
|
||||||
if (strtotime($birthday) > time()) {
|
$birthday_date = new \DateTime($birthday);
|
||||||
$bd_timestamp = strtotime($birthday);
|
if ($birthday_date > new \DateTime()) {
|
||||||
|
$poco["bdyear"] = $birthday_date->format("Y");
|
||||||
$poco["bdyear"] = date("Y", $bd_timestamp);
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Invalid birthday
|
||||||
}
|
}
|
||||||
|
|
||||||
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user