When i run cron jobs, i get following error:

What would be the reason for this error. I couldn't find in post issues.

Thank you very much.

Notice: Trying to get property of non-object in xmlsitemap_generate_chunk() (line 169 of /home/tarifeye/public_html/sites/all/modules/xmlsitemap/xmlsitemap.generate.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

trante’s picture

Any comments?

trante’s picture

Does anyone know how can i debug or remove this error on xmlsitemap_generate_chunk method usage?

Anonymous’s picture

Line 169 of xmlsitemap.generate.inc is

      $link['loc'] = xmlsitemap_get_path_alias($link['loc'], $link['language']->language);

So this is telling me that $link['language'] isn't a valid object but should be. Some module other than xmlsitemap is causing this or perhaps you've something defined incorrectly with regard to 'locale'. The easiest method I've found to debug these is to temporarily modify the above to:

       if (!is_object($link['language'])) {
         throw new Exception('$link[language] is not an object');
      }
      $link['loc'] = xmlsitemap_get_path_alias($link['loc'], $link['language']->language);

This will give you a back trace to which should give you a clue.

Anonymous’s picture

Category: support » bug
Priority: Normal » Critical
Status: Active » Needs review
Issue tags: +Release blocker
FileSize
712 bytes

The real problem with this is that $link['language'] can never be an object. Its value is the varchar value from the database. The attached patch resolves this issue.

Status: Needs review » Needs work

The last submitted patch, xmlsitemap-1396220-4.patch, failed testing.

Anonymous’s picture

The patch isn't quite right. The error only happens if the language is set to LANGUAGE_NONE. Further development to resolve this issue is occurring.

Anonymous’s picture

Component: xmlsitemap.module » Code
Assigned: Unassigned »
Priority: Critical » Major
Status: Needs work » Active

I'm thinking that this issue is resolved by #1593508: The value of 'language' when the value is LANGUAGE_NONE. Please test it a let me know if it resolves the issue.

2pha’s picture

The patch linked to above fixed the issue for me

chromix’s picture

Issue summary: View changes
FileSize
726 bytes

Here's an updated patch. Seems to have quieted down the logs, which is good. Hopefully this one passes.

gratefulsk’s picture

Thanks Chromix. Your patch fixed these errors for me.

Grayside’s picture

Assigned: » Unassigned
Status: Active » Needs review
agerson’s picture

This works for me as well.

andrei.dincu’s picture

Works fine for me also.
Good job chromix.

andrei.dincu’s picture

Status: Needs review » Reviewed & tested by the community
jasom’s picture

Error disappeared thanks to patch in #9.

marcoka’s picture

also have that notice galore in my logs. #9 seems to fix. will report back if i discover problems.

scareyclott’s picture

Hi,
I am using Version 7.x-2.3 and getting the same error but about line 188
Notice: Trying to get property of non-object in xmlsitemap_generate_chunk() (line 188

I guess it is the same issue as a look at the line shows it talks about Language. I am not a coder is it possible for someone to re jig the Patch for Version 7.x-2.3

Regards Scott

aralnoth’s picture

I have the same issue in 8.x version. I tested the patch in #9, making the necessary changes to adapt it to the drupal 8 code, and works properly.

devad’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
819 bytes

#9 patch re-roll for latest .dev

Some reviews would be nice and if it is becomes RTBC again... commit would be nice as well before new re-roll is needed.

pifagor’s picture

look good

devad’s picture

Status: Needs review » Reviewed & tested by the community
alex_optim’s picture

+1

pifagor’s picture

  • pifagor committed 9dd6fc8 on 7.x-2.x authored by devad
    Issue #1396220 by earnie, devad, chromix, trante, andrei.dincu, pifagor...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed
marco-s’s picture

Status: Fixed » Needs review
FileSize
1014 bytes

Unfortunately, this modification generates another issue. With this change, the language value in the URL is missing because the url() function expects an object for the language (see: includes/common.inc:2311). We have to convert the value to an object, not the object to string.

This patch is based on the current dev version (dev-2.x e47457f).

SurfinSpirit’s picture

Faced the same issue marco-s noticed. Given this issue already has committed code opened a new issue as a follow up. https://www.drupal.org/project/xmlsitemap/issues/2987673

marco-s there is no need to convert value to object, language object is already there before the code from this issue patch is executed so the line that rewrites the object by language code should be removed and the code below needs to be adjusted.

pifagor’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

vbard’s picture

Just saw this in Drupal dblog with latest dev:
Notice: Trying to get property of non-object в функции xmlsitemap_generate_chunk() (строка 213 в файле /home/admin/web/mydomain/public_html/sites/all/modules/xmlsitemap/xmlsitemap.generate.inc).