Error when publishing page

Permalink Browser Info Environment
Hi.
I installed this add-on.
It works fine when the page is in edit mode.
So I am reasonably confident that there is nothing wrong with code.

But when saved and/or published, Concrete5 generates an error.
Even a simple php echo hello world statement will fail.

Please help me to fix the error

1 Attachment

Type: Discussion
Status: In Progress
timconsidine
View Replies:
lobar replied on at Permalink Reply
lobar
Hi timeconsidine, have you tried to print the content of $content to see if the PHP code is correct?

As you see, it's a simple 'eval' call.. So something must be wrong with $content.

NB. It's been a while since I haven't played with concrete, so it may also be related to an update of the core framework.
timconsidine replied on at Permalink Reply
timconsidine
Thank you for your prompt reply.

I tried with a simple :

<?php
echo "Hello world";
?>

It fails even with this

And it works fine when the page is in edit mode. So I am confident that the php code is fine.
lobar replied on at Permalink Reply
lobar
Okay interesting... I'll have a look tomorrow if possible. Please be patient :)
timconsidine replied on at Permalink Reply
timconsidine
Thank you for your prompt reply.

I tried with a simple :

<?php
echo "Hello world";
?>

It fails even with this
lobar replied on at Permalink Reply
lobar
Hi,

I've tested the block with the latest version 5.7.5.9, and everything seems to be fine.

Do you still have the issue?
gmurillo replied on at Permalink Reply
gmurillo
Hi,

I have the same problem.
I used this add-on before in other site without problems. But in this case I have this issue :(

Thanks for help,
gmurillo replied on at Permalink Reply
gmurillo
Hi,

sorry, really my problem is diferent. I don't have problem to echo "hello", but my problem is with api references like that's

<?php
print $c->getCollectionName();
?>

I receive this error:

Call to a member function getCollectionName() on null

Thanks for help,
lobar replied on at Permalink Reply
lobar
Hi gmurillo,

so the 'echo' test is working fine for you with the latest version?

For the null reference, I think the Php context is not loaded correctly. I've you tried importing your classes?

(note: I really haven't found the time to investigate the errors these days... sry for the delay)
gmurillo replied on at Permalink Reply
gmurillo
Hi,

yes the echo with a normal text works fine.

but if I try to get the value of some method from the Api of Concrete5 I have this error.

It works fine in developer mode, but when I try to publish page, gives the error.

I don't understand when you said to load classes. :(

Thanks
gmurillo replied on at Permalink Reply
gmurillo
Hi,

thanks I resolve my problem. I need a first line to load the handler of the page, like thats

$c= \Page::getCurrentPage();

Regards,
lobar replied on at Permalink Reply
lobar
Happy it works for you!

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.6
Version Installed - 5.7.5.6
Database Version - 20151221000000

# concrete5 Packages
Automatic Email Obfuscator (2.0.1), Framework Theme (1.2.2), HTML+PHP Code Block (1.0.1), Stylish Ordered Lists (1.0), Vimeo Video (1.0.1).

# concrete5 Overrides
languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.16 (Amazon) PHP/5.6.17

# Server API
apache2handler

# PHP Version
5.6.17

# PHP Extensions
apache2handler, bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
sql.safe_mode - Off
upload_max_filesize - 2M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 1440

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 OPR/36.0.2130.65

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.