8000 bug #54528 [HttpFoundation] defer addition of new method argument to … · symfony/symfony@6cd69fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 6cd69fd

Browse files
committed
bug #54528 [HttpFoundation] defer addition of new method argument to 8.0 (xabbuh)
This PR was merged into the 7.1 branch. Discussion ---------- [HttpFoundation] defer addition of new method argument to 8.0 | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #51502 (comment) | License | MIT Commits ------- 8fadaca defer addition of new method argument to 8.0
2 parents ce408ab + 8fadaca commit 6cd69fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/HttpFoundation/UriSigner.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ public function __construct(#[\SensitiveParameter] string $secret, string $hashP
5151
*
5252
* The expiration is added as a query string parameter.
5353
*/
54-
public function sign(string $uri, \DateTimeInterface|\DateInterval|int|null $expiration = null): string
54+
public function sign(string $uri/*, \DateTimeInterface|\DateInterval|int|null $expiration = null*/): string
5555
{
56+
$expiration = null;
57+
58+
if (1 < \func_num_args()) {
59+
$expiration = func_get_arg(1);
60+
}
61+
62+
if (null !== $expiration && !$expiration instanceof \DateTimeInterface && !$expiration instanceof \DateInterval && !\is_int($expiration)) {
63+
throw new \TypeError(sprintf('The second argument of %s() must be an instance of %s or %s, an integer or null (%s given).', __METHOD__, \DateTimeInterface::class, \DateInterval::class, get_debug_type($expiration)));
64+
}
65+
5666
$url = parse_url($uri);
5767
$params = [];
5868

0 commit comments

Comments
 (0)
0