|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43023 Bug on set stream NULL
Submitted: 2007-10-18 18:04 UTC Modified: 2007-10-29 01:00 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: federeghe at hotmail dot it Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.3CVS-2007-10-18 (CVS) OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: federeghe at hotmail dot it
New email:
PHP Version: OS:


 [2007-10-18 18:04 UTC] federeghe at hotmail dot it
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'));
$this->stream=NULL;  //Crash apache (???)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-19 08:31 UTC]
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-19 08:32 UTC]
And please explain what "crash" means in this context. A segfault? Then please also provide a backtrace.
 [2007-10-19 12:50 UTC] federeghe at hotmail dot it
This is complete script

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

function inc($file,$once=0) {
	if($once==0) {
	if($once==1) {

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

class page 
	var $content;
	var $head;
	var $title;
	function add($text) 
	function head($text)
	function 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);

	function specialpage($page)
	 	global $file;
				$this->title = 'Login';
				$this->title = 'Login Prof';



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.
 [2007-10-19 12:52 UTC] federeghe at hotmail dot it
on 3? line there isn't "exit"... Error on copy-past
 [2007-10-21 15:27 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2007-10-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue May 30 12:03:39 2023 UTC