svanschu / SchuWeb-Sitemap

SchuWeb Sitemap is a sitemap generator for Joomla CMS
GNU General Public License v3.0
13 stars 9 forks source link

Message: Warning: Undefined property: stdClass::$subnodes #134

Closed peterhulst closed 2 months ago

peterhulst commented 4 months ago

Steps to reproduce Set option: Remove duplicate menu: YES

Then (somethimes) this message is shown a few times (with error reporting: maximum): _Message: Warning: Undefined property: stdClass::$subnodes in ....components\com_schuwebsitemap\src\Model\SitemapModel.php on line 266

Expected behavior No warning message

Actual result See message above.

System information Joomla version: 4.4.4 SchuWeb-Sitemap version: 5.1.0 PHP version: 8.1.23 Database version: mysql 8.0.3

svanschu commented 2 months ago

The warning should be gone with this version.

Please test

pkg_schuweb_sitemap_5.1.1-134_20240613.zip

peterhulst commented 2 months ago

I have installed the fix and did not see the warning anymore. However the original warning with the original 5.1.0 code also didn't came up anymore. I have seen your code fix and it looks fine. Thanks.

peterhulst commented 2 months ago

Hello,

Today on a local Joomla installation the error still exists with, also with fix #134. I make a small modification and now it is fixed: Line: if (!isset($node->subnodes) && empty((array) ($node->subnodes))) { should be: if (!isset($node->subnodes) || empty((array) ($node->subnodes))) {

Regards, Peter