modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

Setting &parents=`0` in pdoTools now returns parser error #13723

Closed wshawn closed 6 years ago

wshawn commented 6 years ago

Since 2.6.x (maybe before) receive logs filled with:

[2017-12-17 07:00:56] (ERROR @ /home/somesite/public_html/core/model/modx/modx.class.php : 990) `0` is not a valid integer and may not be passed to makeUrl()
[2017-12-17 07:00:56] (ERROR in resource 234 @ /home/somesite/public_html/core/model/modx/modparser.class.php : 1370) Bad link tag `[[~0]]` encountered

Using `&parents=0``` has been the accepted practice since Evolution -- even in Wayfinder.

Replacing the parameter with [[++site_start]] removes the error, but also fails to populate the page.

I tried to bypass the parser request by using &resources=-0. Didn't work.

Environment

MODX Revolution 2.6.1-pl (traditional) Apache 2.x Mysql version 5.5.51-38.2 PHP version 7.0.25 Browser - doesn't matter

Mark-H commented 6 years ago

Those errors are correct, 0 is not a valid resource ID to link to. Those logs were added in the 2.5.x series - 2.5.4 IIRC?

If you're seeing it as a result of a pdoTools call, then either it's something in pdoTools that calls makeUrl on a 0 parent, or something in your chunk. Either way I'm not seeing a bug in the core in this report?

OptimusCrime commented 6 years ago

This seem to be an issue with pdoTools, not MODX Revolution? I am not sure what pdoTools does in this scenario (your issue lacks instructions of how to reproduce the problem), but if you end up creating a link [[~0]] that is invalid MODX syntax.

I suggest closing this and opening an issue in pdoTools instead.

Edit: @Mark-H wow, same second 👍

labr1005 commented 6 years ago

Yeah, that was introduced here #13265. And I still think that the log level should be lowered...

Jako commented 6 years ago

Yeah, that was introduced here #13265. And I still think that the log level should be lowered...

Prepare a PR with that.

wshawn commented 6 years ago

I will try to bring it to their attention. I assumed it may have been something due to strict types of PHP 7 and changes to MODX - which I have not had time to peruse. A Ph.D. dissertation is fun....

@bezumkin does not allow forks, issues, etc. (at least for me). It should be an easy fix around line 1316 of the pdotools class. I tried.