seo icon indicating copy to clipboard operation
seo copied to clipboard

Deprecated features and undefined variable

Open binkapS opened this issue 9 months ago • 4 comments

PHP Deprecated: Melbahja\Seo\Sitemap::__construct(): Implicitly marking parameter $options as nullable is deprecated, the explicit nullable type must be used instead in /home/gamerighq/htdocs/gamerighq.com/vendor/melbahja/seo/src/Sitemap.php on line 52 PHP Deprecated: Melbahja\Seo\Interfaces\SitemapIndexInterface::__construct(): Implicitly marking parameter $options as nullable is deprecated, the explicit nullable type must be used instead in vendor/melbahja/seo/src/Interfaces/SitemapIndexInterface.php on line 13

In Sitemap.php line 200:

Undefined variable $name

binkapS avatar Jun 02 '25 07:06 binkapS

can you provide code to reproduce it ?

melbahja avatar Jun 03 '25 00:06 melbahja

$sitemap = new Sitemap(config('app.url'), ['save_path' => public_path('sitemap')]);
        $sitemap->links(['name' => 'categories.xml', 'images' => false], function ($map) {
            Category::all()->each(function ($category) use ($map) {
                $map->loc("/category/{$category->slug}")
                    ->freq('weekly')->priority('0.9')
                    ->lastMod($category->updated_at->toDateString());
            });
        });
 $sitemap->save();

It's a laravel project The category class is a Model PHP Version Info:

PHP 8.4.5 (cli) (built: Mar 17 2025 20:35:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.5, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.5, Copyright (c), by Zend Technologies

binkapS avatar Jun 03 '25 12:06 binkapS

This ticket reports 2 bugs, both affecting version 2.1.1. I recommend to focus this report on the deprecation and file a different ticket to track the undefined variable.

Chealer avatar Aug 26 '25 04:08 Chealer

@melbahja: The deprecation only needs constructing a Sitemap object with a PHP version of at least 8.4, which deprecates such synopses.

Chealer avatar Aug 26 '25 12:08 Chealer

v3 has been released with support for php >= 8.1, so this issue has been resolved, thank you all

melbahja avatar Jan 19 '26 18:01 melbahja