php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24744 Using a function that returns a reference crashes php
Submitted: 2003-07-21 17:41 UTC Modified: 2003-07-22 03:21 UTC
From: vma1 at abv dot bg Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4CVS-2003-07-21 (stable) OS: Slackware Linux 9.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vma1 at abv dot bg
New email:
PHP Version: OS:

 

 [2003-07-21 17:41 UTC] vma1 at abv dot bg
Description:
------------
The following code causes the apache 1.3.27 compiled statically with php to crash. The apache process that tries to execute the script terminates with a segfault. When the function returns the value not by reference everything works OK.

These are my php.ini specific settings:

allow_call_time_pass_reference = Off
expose_php = Off
max_execution_time = 120     ; Maximum execution time of each script, in seconds
error_reporting  =  E_ALL
display_startup_errors = On
log_errors = On
error_log = /usr/local/apache/logs/php_log
register_argc_argv = Off
magic_quotes_gpc = Off
always_populate_raw_post_data = On
upload_tmp_dir = /tmp
upload_max_filesize = 16M
; SMTP = localhost
; sendmail_from = me@localhost.com
sendmail_path = "/usr/local/sbin/ssmtp -t"


Reproduce code:
---------------
lass lala
{
	var $val;
	
	function lala ()
	{
		$this->val = 0;
	}
	
	function &get_val ()
	{
		$inf = 88;
		$this->val = $inf;
		return ($inf);
	}
}

$obj = new lala;
$vvv = &$obj->get_val ();
echo $obj->val;



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-22 03:21 UTC] sniper@php.net
Fixed in PHP 5, won't be fixed for PHP 4.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 02 03:00:02 2025 UTC