Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Parameter Deprecation Notices #51147

Closed
aldobarr opened this issue Apr 20, 2024 · 1 comment
Closed

Null Parameter Deprecation Notices #51147

aldobarr opened this issue Apr 20, 2024 · 1 comment

Comments

@aldobarr
Copy link
Contributor

aldobarr commented Apr 20, 2024

Laravel Version

10.48.8

PHP Version

8.2.16

Database Driver & Version

No response

Description

UrlGenerator has the following deprecation notices:

  1. PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /src/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 570
  2. PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /src/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 633

Steps To Reproduce

This can be easily replicated with a unit test such as:

<?php

declare(strict_types=1);

namespace Tests\Unit\Actions;

use Illuminate\Testing\TestResponse;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

class UrlTest extends TestCase
{
    #[Test]
    public function url_deprecation_test(): void
    {
        $redirect = redirect('/');
        $response = new TestResponse(response($redirect));
        $response->assertLocation('/');
    }
}

Here, assertLocation will pass a null value as $path and trigger the deprecation notices.

@aldobarr aldobarr changed the title String Deprecation Warnings Null Parameter Deprecation Notices Apr 20, 2024
@driesvints
Copy link
Member

Thanks for the PR. Let's see how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants