PHP warning when using parseContentShortcut(): Passing null to parameter #884
-
I'm developing a blog section for my website, and wanted to display my blog tags as a list on the blog-start layout page. I used the code However, doing this also displayed the warning, "Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in [path]\system\extensions\core.php on line 2335" (full path altered for privacy). So I investigated line 2335 and with a bit of Google-fu found that changing Anyway, just wanted to pass that along! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I checked the source code and think this is not a bug in the core. I suspect the calling code is wrong. For newer PHP versions Can you use |
Beta Was this translation helpful? Give feedback.
-
During my extensive tests for #800 lately I also came across this message and can confirm that passing either shortcut parameters or just an empty string to the calling code will fix the warning. |
Beta Was this translation helpful? Give feedback.
I checked the source code and think this is not a bug in the core. I suspect the calling code is wrong. For newer PHP versions
null
and strings are non-interchangeable types, there's no automatic type cast anymore, so I think the second argument in the calling code must be a string. Sometimes it is enough to manually replacenull
by""
.Can you use
parseContentShortcut("blogtags", "", "inline")
and check if this fixes the problem?