Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Blank white page - Smarty object exists and is populated

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
bb
Smarty n00b


Joined: 01 Oct 2020
Posts: 3

PostPosted: Thu Oct 01, 2020 6:47 pm    Post subject: Blank white page - Smarty object exists and is populated Reply with quote

Hello forum,

I`ve been fighting with this for days now - I have my own framework for CMS and use Smarty as my template engine. Suddenly, the page output was only white and I can't make it work again. Setting the debug option doesn't open up the usual popup window either.
Using the php debug output there are no errors on the page (just a few warnings), but when I var_dump the Smarty object as the very last line in the code the output is just populated correctly with the values coming from the database.
Creating a test page with just one variable does not work either.

I just don't know where to look any more....
php version: 7.4.10
Smarty Version: 2.6.27 (I know, I know - quite old. Haven't had the time to upgrade to v3 yet)
apache version: 2.4.46 (FreeBSD) OpenSSL/1.0.2u-freebsd

Thanks a lot in advance!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Oct 02, 2020 8:17 am    Post subject: Reply with quote

Check the server logs. Most likely you have error in your PHP code.
Quote:
White Screen Of Death (WSOD): If you're seeing a blank page (and view-source is empty), please read https://stackoverflow.com/questions/845021/how-can-i-get-useful-error-messages-in-php/33665510#33665510
Back to top
View user's profile Send private message
bb
Smarty n00b


Joined: 01 Oct 2020
Posts: 3

PostPosted: Mon Oct 05, 2020 3:13 pm    Post subject: Reply with quote

Thanks for that link. The importance of putting the display_error and error_reporting into the php.ini is new to me, but very useful.

Unfortunetly, even with those 2 values in the php.ini I don't get any new error messages. Also, I don't think it's a php error, as my very last line in the php file is executed where I do a
Code:
var_export($smarty)


And in that export I see the content I want to display.

Another thing I noticed is that in the templates_c directory the corresponding file to my template contains nothing but the compile information. Is this maybe a hint? The directory rights are 775, so the webserver can write there.

Thanks!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Oct 06, 2020 9:53 am    Post subject: Reply with quote

If compiled template contains no actual PHP code, that may be a problem in your template or the way you are referencing it.
Back to top
View user's profile Send private message
bb
Smarty n00b


Joined: 01 Oct 2020
Posts: 3

PostPosted: Tue Oct 06, 2020 9:14 pm    Post subject: Reply with quote

ok, I've found out something....this is the setup:
one domain running php 5
another domain running php 7

same php+tpl works under php 5, but not under php7. The only warning I get under php 7 is this:
Code:
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in [..]/Smarty_Compiler.class.php on line 270


but I think this is not the reason, as I've already had the script running under php 7. Is there any apache directive that could prevent Smarty from working?
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Tue Oct 06, 2020 11:49 pm    Post subject: Reply with quote

I cannot assume this would work with Smarty 2, but if Smarty is throwing an exception, then in your PHP code, try to create an exception handler - if your CMS does not have one already.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Oct 07, 2020 3:36 am    Post subject: Reply with quote

bb wrote:
The only warning I get under php 7 is this:
Code:
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in [..]/Smarty_Compiler.class.php on line 270

This is not a warning, this is a compilation error. PHP compilation error, not Smarty. Go upgrade your libs.

Quote:
but I think this is not the reason, as I've already had the script running under php 7. Is there any apache directive that could prevent Smarty from working?

The error message is quite clear, don't you think? You are using version of Smarty that is not compatible with PHP7.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP