Hello, i get 2 notice, when visiting nodes, after enabling and configuring this module and tokens.

Notice: Undefined property: stdClass::$unpublish_on in scheduler_tokens() (line 47 of \sites\all\modules\contrib\scheduler\scheduler.tokens.inc).

Notice: Undefined property: stdClass::$publish_on in scheduler_tokens() (line 47 of \sites\all\modules\contrib\scheduler\scheduler.tokens.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PushaMD created an issue. See original summary.

PushaMD’s picture

mini-patch, checking if the node has the property.

jonathan1055’s picture

Title: scheduler_tokens() line 47 » Undefined property $publish_on in scheduler_tokens() line 47
Status: Active » Reviewed & tested by the community

Hi PushaMD,
Thanks for reporting this. Yes I can replicate this error and your patch does solve it. I have checked and in 8.x we don't get this warning.
Jonathan

jonathan1055’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.14 KB

Actually, I thought it would be good to cover the case of 'no dates' in the automated testing. Here's a patch which adds to the existing testTokenReplacement() but without the fix in #2 so we should get warnings about the undefined properties.

Status: Needs review » Needs work

The last submitted patch, 4: 2934328-4.tokens_property.test-only.patch, failed testing. View results

jonathan1055’s picture

That's good, as expected. Now adding the fix from #2 with the test change.

nipany’s picture

Some minor changes on fix from #2

Status: Needs review » Needs work

The last submitted patch, 7: 2934328-7.scheduler_tokens.patch, failed testing. View results

nipany’s picture

Updated patch on fix from #2

jonathan1055’s picture

Hi nipane,
Thanks for your interest in this issue. However, your patches do not seem quite right, they revert code in the earlier patches, and also do not include the test coverage that was added in patch #6. In these issue threads with patches we always want to build on the latest existing patch so could I request the following:
(a) please explain what you think is wrong with the patch in #6
(b) make your changes on top of the changes in #6 so that the new test coverage is inculded in you patch
(c) if possible provide an interdiff text file if the changes you are making are not obvious, so that other can review you patch more easily

Thanks
Jonathan

ciss’s picture

Status: Needs work » Needs review

TLDR: Current patch is in #6.

The suggested change in #7 and #9 doesn't make (any obvious) sense. I'm hiding those patches in order to shift focus back to the patch in #6.

smartsystems160’s picture

patch #2 returns error: patch unexpectedly ends in the middle of line
patch -p0 --dry-run < checking_property-2934328-1.patch

patch #6 returns error: patch unexpectedly ends in the middle of line. Hunk #1 FAILED at 44.
patch -p0 --dry-run < 2934328-6.tokens_property_and_test.patch

hitfactory’s picture

Attaching re-roll of #6 so it applies to latest 7.x-1.x.

jonathan1055’s picture

Thanks for re-rolling. However, there wasn't actually anything wrong with the patch in #6 and your re-roll in #13 is actually identical, apart from the fact that you have swapped round the order of the two files being changed (scheduler.tokens.inc followed by scheduler.test). I have just re-tested #6 and there are no warnings in the jenkins console log when applying the patch.

The last submitted patch, 4: 2934328-4.tokens_property.test-only.patch, failed testing. View results

hitfactory’s picture

I had blindly followed the comment in #12 thinking that was the reason the patch had not been accepted, but now I see it's fine.

I can confirm that the Undefined property etc notices disappear with the patch. However, I can't vouch for the updates to the tests as I haven't looked at them too deeply.

glynster’s picture

+1 RTBC as this did not seem to reach the last dev release. Any reason why? I was flooded again with notices are updating to the latest version. Applied this patch and they were all removed.

jonathan1055’s picture

Hi glynster,

did not seem to reach the last dev release. Any reason why?

No reason other than it was not actually marked RTBC, so I have not committed it yet. Looks good, so will do soon.

  • jonathan1055 committed 1bcc10b on 7.x-1.x authored by PushaMD
    Issue #2934328 by jonathan1055, PushaMD, hitfactory: Fix undefined...
jonathan1055’s picture

Title: Undefined property $publish_on in scheduler_tokens() line 47 » Fix undefined property $publish_on in scheduler_tokens() line 47
Issue summary: View changes
Status: Needs review » Fixed

Committed and fixed.
Thanks PushaMD for the original patch.

glynster’s picture

@jonathan1055 thanks so much!

Status: Fixed » Closed (fixed)

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