php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24187 Smarty causes "page could not load" error
Submitted: 2003-06-14 18:03 UTC Modified: 2003-06-29 12:03 UTC
From: terjeto at stud dot ntnu dot no Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-06-14 (dev) OS: Red Hat 9.0
Private report: No CVE-ID: None
 [2003-06-14 18:03 UTC] terjeto at stud dot ntnu dot no
Description:
------------
A function get_array() inside the class Foo tries to 
return an array stored inside the class. This worked 
fine in PHP4, but in the latest PHP5 the webpage wont 
load.

Reproduce code:
---------------
class Foo {

  var $array = array();

  function get_array() {
    return $this->array;
  }

}

Expected result:
----------------
expected to see the page or at least an error message 
of what the problem was.

Actual result:
--------------
the page didnt load at all. i got "page could not load" 
every time. if i commented the "return ..." and 
replaced it with "return true;" or anything else it 
worked, but when i tried to return an array the webpage 
wouldnt load at all

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-14 18:06 UTC] terjeto at stud dot ntnu dot no
worked with return $this::array; .... :)
 [2003-06-15 03:08 UTC] derick@php.net
But it's still a bug. Can you provide a full script (ie, we can copy and paste it and run it, that script includes <?php ... ?> then)?

Derick
 [2003-06-15 06:47 UTC] terjeto at stud dot ntnu dot no
Cant seem to manage to reproduce the error.. The 
problem wasnt what I first thought thou. After several 
trials I get the same error with :: and ->. My old code 
still produces the same error. Seems to have something 
to do with Smarty. When I load Smarty and run the 
display( 'index.tpl' ) it causes the "page could not 
load" error. I sometimes get a lot of warnings, like : 
fetch() could not find index.tpl etc. And it doesnt 
produce any files in the template_c folder, so 
something is wrong...
 [2003-06-15 07:21 UTC] stas@php.net
Please try to produce the reproducing code for the problem that shown it is an engine problem and not the Smarty code problem. 
 [2003-06-15 09:19 UTC] terjeto at stud dot ntnu dot no
ok. had to run some tests and go through the smarty 
code, took some time.

but doesnt seem to be the smarty coding itself thats 
the problem. and i cant reproduce a code that 'brings 
forth' the problem eather.

im currently writing my code on a mac using BBedit, 
storing it on my linux server (using unix line breaks). 
my old code ( written on the mac, but with php 4.2.3 ) 
worked fine, but on php5 i get these 'random' parse 
errors. when i was testing the smarty code i added some 
print('test'); exit; lines to see where the problem 
could be. i was then just abt line 1000. and regulary 
after editing a line i for some reason got a parse 
error on line 2400+. all i had to do was put a empty 
line there. and thats not the first time something like 
that happens, i also have had delete a line just to 
write it again, exactly the same, because it caused a 
parse error.

sorry that i cant reproduce any code with this 
problem.. i comes and goes as it wants on my server 
too..

when i was debuging the smarty code i say added a print 
statement at line 1090 and got "page could not load" 
error. after some trials i maybe found that line 1070 
worked while 1071 didnt work (nb! without changing the 
existing line breaks). if i then added a empty line at 
1071 and tried again it worked, i no longer got a "page 
could not load" error on that line, there where many of 
those. seemed like it didnt like the existing line 
break...

( this might be messy.. sorry )
 [2003-06-17 11:27 UTC] tony2001 at ua dot fm
I think there is the problem, that was described in bug #21669.
Smarty uses $this->var = new $class; syntax, but it doesn't work with current PHP5-CVS.
IMHO the "page could not load" message is standard MSIE message when Apache crashes down.
 [2003-06-18 04:04 UTC] terjeto at stud dot ntnu dot no
as i dont know exactly what this is yet i thought i wasnt gonna post much more till i find out, but just for the record; i noticed that $this->var = new $class; didnt work and instead changed it to $this->var = new Smarty_Compiler; as it was in the smarty code. This i did before all those other errors i got.. but cant say that helpt...
 [2003-06-29 11:53 UTC] terjeto at stud dot ntnu dot no
smarty (where the problem first occured) works fine 
with php4, and ive gotten it to work with the latest 
php5 too. i had some problems with an earlyer php5-cvs, 
but ive tested with the latest and it now works fine 
(except bug #24286)

my earlyer problems caused my apache server to crash a 
few times too, and left some "unfinished" processes 
left. so i had three apache processes that used 96% cpu 
each... but after killing those and starting a new with 
latest php5-cvs this hasnt happened again...
 [2003-06-29 12:03 UTC] iliaa@php.net
User reports that the problem has been fixed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 21:01:33 2025 UTC