ID:               43023
 User updated by:  federeghe at hotmail dot it
 Reported By:      federeghe at hotmail dot it
-Status:           Feedback
+Status:           Open
 Bug Type:         Reproducible crash
 Operating System: All
 PHP Version:      5.3CVS-2007-10-18 (CVS)
 New Comment:

This is complete script
<?php

if(!defined("IN_RESCHOOL")) exit;                                               
        //If not defined "go costant"
exit
error_reporting("E_ALL");
$file = new file;
$page = new page;

function inc($file,$once=0) {
        if($once==0) {
                include($file);
        }
        if($once==1) {
                include_once($file);
        }
}

class file
{
        var $stream;
        function read($filename)
        {
                $this->stream = fopen('./'.$filename, 'r');
                $return = fread($this->stream,filesize($filename));
                fclose($this->stream);
                $this->stream=NULL;  //Crash apache (???)
                return($return);
        }
}

class page 
{
        var $content;
        var $head;
        var $title;
        
        function add($text) 
        {
                $this->content.=$text;
        }
        
        function head($text)
        {
                $this->head=$text;
        }
        function title($title)
        {
                $this->title=$title;    
        }
        
        function go()
        {
                global $file;
                $html = $file->read('html/standard.phtml');
                $html = replace($html);
                echo $html;
        }
        
        function replace($text) 
        {
                $text = str_replace("{CONTENT}",$this->content,$text);
                $text = str_replace("{TITLE}",$this->title,$text);
                $text = str_replace("{HEAD}",$this->head,$text);
                $text = str_replace("{MENU}",$this->menu(),$text);
                $text = str_replace("{NAME}",$config->name_school,$text);
                return($text);
        }

        function specialpage($page)
        {
                global $file;
                switch($page) 
                {
                        case('login-student'):
                                $this->title = 'Login';
                                
$this->head($file->read('html/login-student-head.phtml'));
                                
$this->add($file->read('html/login-student.phtml'));
                        break;
                        case('login-prof'):
                                $this->title = 'Login Prof';
                                
$this->head($file->read('html/login-prof-head.phtml'));
                                
$this->add($file->read('html/login-prof.phtml'));
                        break;
                }
        }

}

?>

In windows the crash is:

"Si è verificato un errore in Apache.exe. L'applicazione verrà
chiusa."
equal to
"An error occurred in Apache.exe. The application will be closed."

on linux I don't know the crash but 
"The page cannot be displayed"
to all other pages.


Previous Comments:
------------------------------------------------------------------------

[2007-10-19 08:32:18] [EMAIL PROTECTED]

And please explain what "crash" means in this context. A segfault? Then
please also provide a backtrace.

------------------------------------------------------------------------

[2007-10-19 08:31:25] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

------------------------------------------------------------------------

[2007-10-18 18:04:42] federeghe at hotmail dot it

Description:
------------
View code. On 4° line, apache crashes...

Reproduce code:
---------------
$this->stream = fopen('./html/page.phtml', 'r');
$this->page = fread($this->stream,filesize('./html/page.phtml'));
fclose($this->stream);
$this->stream=NULL;  //Crash apache (???)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43023&edit=1

Reply via email to