Merge pull request #58911 from nextcloud/backport/58201/stable33
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Integration sqlite / changes (push) Waiting to run
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, --tags ~@large files_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, capabilities_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, collaboration_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, comments_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, dav_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, federation_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, file_conversions) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, files_reminders) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, filesdrop_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, ldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, openldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, openldap_numerical_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, remoteapi_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, routing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, setup_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, sharees_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, sharing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, theming_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable33, 8.4, stable33, videoverification_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite-summary (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ncu (push) Has been cancelled

[stable33] fix: Remove deprecated RFC7231 constant to avoid warnings on PHP 8.5
This commit is contained in:
Daniel 2026-03-13 13:38:21 +01:00 committed by GitHub
commit cac3488197
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 7 deletions

View file

@ -7,6 +7,7 @@
namespace OCA\DAV\Provisioning\Apple;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Constants;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\INode;
use Sabre\DAV\IProperties;
@ -58,7 +59,7 @@ class AppleProvisioningNode implements INode, IProperties {
return [
'{DAV:}getcontentlength' => 42,
'{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC7231),
'{DAV:}getlastmodified' => $datetime->format(Constants::DATE_RFC7231),
];
}

View file

@ -11,6 +11,7 @@ namespace OC\AppFramework\Middleware;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\Constants;
use OCP\IRequest;
class NotModifiedMiddleware extends Middleware {
@ -29,7 +30,7 @@ class NotModifiedMiddleware extends Middleware {
}
$modifiedSinceHeader = $this->request->getHeader('IF_MODIFIED_SINCE');
if ($modifiedSinceHeader !== '' && $response->getLastModified() !== null && trim($modifiedSinceHeader) === $response->getLastModified()->format(\DateTimeInterface::RFC7231)) {
if ($modifiedSinceHeader !== '' && $response->getLastModified() !== null && trim($modifiedSinceHeader) === $response->getLastModified()->format(Constants::DATE_RFC7231)) {
$response->setStatus(Http::STATUS_NOT_MODIFIED);
return $response;
}

View file

@ -9,6 +9,7 @@ namespace OCP\AppFramework\Http;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Constants;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
@ -98,7 +99,7 @@ class Response {
$time = \OCP\Server::get(ITimeFactory::class);
$expires->setTimestamp($time->getTime());
$expires->add(new \DateInterval('PT' . $cacheSeconds . 'S'));
$this->addHeader('Expires', $expires->format(\DateTimeInterface::RFC7231));
$this->addHeader('Expires', $expires->format(Constants::DATE_RFC7231));
} else {
$this->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
unset($this->headers['Expires']);
@ -240,7 +241,7 @@ class Response {
];
if ($this->lastModified) {
$mergeWith['Last-Modified'] = $this->lastModified->format(\DateTimeInterface::RFC7231);
$mergeWith['Last-Modified'] = $this->lastModified->format(Constants::DATE_RFC7231);
}
if ($this->ETag) {

View file

@ -59,4 +59,12 @@ class Constants {
* cf. sharing.maxAutocompleteResults in config.sample.php.
*/
public const SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT = 25;
/**
* Replacement for the built-in `DATE_RFC7231` constant
* deprecated since PHP 8.5.
*
* @since 33.0.1
*/
public const DATE_RFC7231 = 'D, d M Y H:i:s \G\M\T';
}

View file

@ -12,6 +12,7 @@ use OC\AppFramework\Middleware\NotModifiedMiddleware;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Response;
use OCP\Constants;
use OCP\IRequest;
class NotModifiedMiddlewareTest extends \Test\TestCase {
@ -44,13 +45,13 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
[null, '"etag"', null, '', false],
['etag', '"etag"', null, '', true],
[null, '', $now, $now->format(\DateTimeInterface::RFC7231), true],
[null, '', $now, $now->format(Constants::DATE_RFC7231), true],
[null, '', $now, $now->format(\DateTimeInterface::ATOM), false],
[null, '', null, $now->format(\DateTimeInterface::RFC7231), false],
[null, '', null, $now->format(Constants::DATE_RFC7231), false],
[null, '', $now, '', false],
['etag', '"etag"', $now, $now->format(\DateTimeInterface::ATOM), true],
['etag', '"etag"', $now, $now->format(\DateTimeInterface::RFC7231), true],
['etag', '"etag"', $now, $now->format(Constants::DATE_RFC7231), true],
];
}