From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1687982318; bh=m7dxl8QXBfwYeuDkb3Z2XxfT8pE+I/7Lqpnv2+F5h7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MtNrujCGiviT72gwD3umzXhDEuNbTgu7TiC65UotCIt+cT66pWBovqFojaLm/hORC X3T+MBWVsZk5ukSTwiPQjqnwntRHC3HPFYLfqWD2dEJLdQ75jqB26/vbrXqz5aVl3H 1w0/JF3w45qbA7tqP6nVOtdCe9nQRskS+QF0DaH95K9lblBb43BmRuaZ9ooXaKh34W 230BD9jFs/xUU6GKfBkyiMTEClv5g4wWMqI8qAVaFM7dPdXQBCa+7ClAZfRFXo8a3f NgD4QLcpMpFSxhi9dUI5Mw+lHOCJASDDeKYc5RrqG0rV/sR4X0ead5p1n874ntHOYf A+THYp3y8dpFw== Received: from integral2.. (unknown [68.183.184.174]) by gnuweeb.org (Postfix) with ESMTPSA id EB3B42370C5; Thu, 29 Jun 2023 02:58:35 +0700 (WIB) From: Ammar Faizi To: GNU/Weeb Mailing List Cc: Ammar Faizi , Michael William Jonathan , Nicholas Rosenberg , GNU/Weeb Facebook Team , VNLX Kernel Department Subject: [PATCH fb v1 1/3] fb: Fix `getCache()` expiration logic handling Date: Thu, 29 Jun 2023 02:58:26 +0700 Message-Id: <20230628195828.1657850-2-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230628195828.1657850-1-ammarfaizi2@gnuweeb.org> References: <20230628195828.1657850-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The getCache() function doesn't take the expiration date into account. Make sure it does. Fixes: 88952f396b1b4831eab3b8ed5d71959e42686a88 ("fb: Introduce `getCache()` and `setCache()` functions") Signed-off-by: Ammar Faizi --- src/Facebook/Facebook.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Facebook/Facebook.php b/src/Facebook/Facebook.php index 00aed812693248a8..6afd735ca4aa6bca 100644 --- a/src/Facebook/Facebook.php +++ b/src/Facebook/Facebook.php @@ -306,6 +306,11 @@ class Facebook return NULL; } + if ($data["exp"] < time()) { + unlink($file); + return NULL; + } + return $data["data"]; } -- Ammar Faizi