RegularLabs\Library\Php::execute(): Argument #2...

Search
Other Bug Reports questions
Forum

RegularLabs\Library\Php::execu​te(): Argument #2 ($rl_article) must be of type object|false|null, string given

Marcel S.'s Avatar Marcel S.
Hi,
after upgrading some modules and plugins (in this case uikit and RegularLabs sourcerer) i get following error:

RegularLabs\Library\Php::execute(): Argument #2 ($rl_article) must be of type object|false|null, string given called in plugins/system/sourcerer/src/Replace.php on line 732

This Error break my environment on every page i use sourcerer in modules who allows me to post html code.

There's no special code needed, just put follwing code in to a module instance who allow html code
{source}
<?php echo "test"; ?>
{/source}

Currently, i run sourcer pro with version 10.0.0 and changed the code on line 732 for "file plugins/system/sourcerer/src/Replace.php"

from :
$output = RL_Php::execute('<?php ' . $script . ' ?>', self::$article)
to:
$output = RL_Php::execute('<?php ' . $script . ' ?>', $article);

It works for now, but i'am sure, this is not the final solution. If i install versions > 10.0 i get blank pages and currently no idea why.


Short Systeminfo:
php8.1
uikit 3.21.5 (3.5.36 for plugin)
Peter van Westen's Avatar Peter van Westen ADMIN
No idea in what situation self::$article could be a string.

Can you give me (super) admin and (s)ftp access so I can take a look?
And tell me on what url I can see/reproduce the issue.
You can use the 'Confidential information' button in the forum editor to hide sensitive information.
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Hi Peter,
thanks for reply and sorry for delay. Is it possible to get your ISP-IP? Because, my site is not public yet and i need to whitelist your access. You also need to setup a hostname for this server because, the domain for this site points to another server.

Confidential information:
(hidden)


Notice:
The issue as described at start posting displayes, if i use sourcerer in a module instance in another modul.

For Example:
{source}
...some php code
{/source}

{loadmodule 161}
Content in Module 161:
{source}
...some php code
{/source}

Thanky in advanced.
Peter van Westen's Avatar Peter van Westen ADMIN
IPv6: 2001:1c01:410e:1700:3479:8f91:16c7:69c9
IPv4: 85.147.255.149
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Thanks Peter, i have whitelist your ipv4
Peter van Westen's Avatar Peter van Westen ADMIN
The issues are down to the RHI_DEFAULT_INCLUSION you are trying define (multiple times) and then check for.
You can't define a constant more than once. And it looks like the files you are including are doing a die(), causing the white pages.

In other words, issues seem to be down to your custom php code, and not down to Sourcerer.
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
PS: To see more php errors, switch on debug mode and php error reporting.
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Hi Peter,

many thanks for your investigation and sorry for my mistake. I'll review my code. Glad to have you're modules.
Marcel S.'s Avatar Marcel S.
Hi Peter,
i have reviewed my code. Yes, you're right, i have declared the constant 'RHI_DEFAULT_INCLUSION' multiple times, but this does not crash my site. I tried to find out what the issue cause but i can find any error output.

>> And it looks like the files you are including are doing a die()
yes, but only if 'RHI_DEFAULT_INCLUSION' not defined.

I turned on the joomla debugger and set my php error reporting also to E_ALL, but i can't see a fatal error. For Testing, i commented out the declaration of Constants and also the check of declaration, but the issue stil exist.

I get a white page in frontend without any errors in my log. Maybe, i can see more results with var_dump(debug_backtrace()).

Currently, i switched back to 10.0.4, which works without any issue in my case.


Thank you very much anyway
Peter van Westen's Avatar Peter van Westen ADMIN
The white page is - as far as I could tell - because of your die() commands. So for some reason the RHI_DEFAULT_INCLUSION check doesn't pass.
So the page is white, there are no errors.

You could replace the die() commands with something like die(__FILE__). Then you can see which file is causing the die and retrace from there.
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Hi Peter,
i fully tried another way to find the issue. In the example of white page issue i created a simple html file with table content and use include function as described in your documentation.
{source}
<?php
   echo file_get_contents( JPATH_SITE.'/myfiles/file.txt' );
?>
{/source}

The content in this file are hundred of lines with like following (each <tr> is one line):
</tr>
<td title="Fabrikat">INA</td>
<td title="Artikel">CSAA070</td>
<td class="bemerkung" title="Bemerkung">soon more available / in Kürze mehr verfügbar</td>
<td title="Bestand" class="text-end">2</td>
<td title="Preis" class="text-end">0,00 €</td>
</tr>

If my file contain more than 532 lines, i get a white page, so the die() commands comes from another script and in this case, i can't fetch the error.
Is there any restriction like content size, file size or any other?

Note: I know, it does not make sence to load a table with 500 lines but i need to figure out what issue triggers the die().

Thanks in advanced.
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, no idea.
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Hi Peter,
good news to you. I found out, that the issue related on my template which use astroid frame work. Test wise, i switched to casiopaia template and my script runs fine.

One question: Do you have a recommendation in which order your plugin should be loaded? Is it better to load your plugin befor third party plugins or after?

Thanks.
Peter van Westen's Avatar Peter van Westen ADMIN
Plugin ordering depends completely on how you use them together.
See: regularlabs.com/blog/242-plugin-order-is-important
Please post a rating at the Joomla! Extensions Directory
Marcel S.'s Avatar Marcel S.
Hi Peter,
just want to inform you, i have found the issue. It comes from astoeroid-frame-work with enabled HTML-Minfyer. Without HTML-Minifyer all works great. I can savely upgrade to actual sourcer build, now.

Please send me your paypal-adress, i like to spent you a beer for your support. This Thread can also marked as solved.

Thanks
Peter van Westen's Avatar Peter van Westen ADMIN
I have no paypal. You can support by buying a subscription. Or just enjoy the free ve4sion.
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in