php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21983 Php SegFault
Submitted: 2003-01-31 08:37 UTC Modified: 2003-02-13 19:47 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: sebest at ovibes dot net Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.3.0 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-01-31 08:37 UTC] sebest at ovibes dot net
$php file.php
Segmentation fault
$

---file.php---
<?
class zactivbox {
	var $network;
	var $proxy;
	var $basename;
	
	var $dom;
	var $e_zactivbox;
	
	function zactivbox (&$dom, $basename, $network, $proxy) {
		$this->dom=& $dom;
		$this->basename=$basename;
		$this->network=$network;
		$this->proxy=$proxy;
	}
	
	function &write_xml () {
		$this->e_zactivbox=$this->dom->create_element('zactivbox');
		$this->e_zactivbox->set_attribute('basename', $this->basename);
		$this->e_zactivbox->append_child($network);
		$this->e_zactivbox->append_child($proxy);
		return $this->e_zactivbox;
	}
}

class network {
	var $servers; //array of server
	var $route;
	var $resolver;

	var $dom;
	var $e_network;
	
	function network (&$dom, $servers, $route, $resolver) {
		$this->dom=& $dom;
		$this->servers=$servers;
		$this->route=$route;
		$this->resolver=$resolver; 
	}
	
	function &write_xml() {
		$this->e_network=$this->dom->create_element('network');
		foreach($this->servers as $key => $server)
		{
			$this->e_network->append_child($server);
		}
		$this->e_network->append_child($this->route);
		$this->e_network->append_child($this->resolver);
		return $this->e_network;
	}
}

class resolver {
	var $domain;
	var $search;
	var $nameserver;
	
	var $dom;
	var $e_resolver;
	
	function resolver (&$dom, $nameserver, $domain='', $search='') {
		$this->dom=& $dom;
		$this->domain=$domain;
		$this->search=$search;
		$this->nameserver=$nameserver;
	}
	
	function &write_xml() {
		$this->e_resolver=$this->dom->create_element('resolver');
		$e_domain=$this->dom->create_element('domain');
		$t_domain=$this->dom->create_text_node($this->domain);
		$e_domain->append_child($t_domain);
		$this->e_resolver->append_child($e_domain);
		$e_search=$this->dom->create_element('search');
		$t_search=$this->dom->create_text_node($this->search);
		$e_search->append_child($t_search);
		$this->e_resolver->append_child($e_search);
		$t_nameserver=$this->dom->create_text_node($this->nameserver);
		$e_nameserver=$this->dom->create_element('nameserver');
		$e_nameserver->append_child($t_nameserver);
		$this->e_resolver->append_child($e_nameserver);
		return $this->e_resolver;
	}
}

class route {
	var $destination;
	var $iface;
	var $ip;

	var $dom;
	var $e_route;
	
	function route (&$dom, $destination, $ip, $iface) {
		$this->dom=& $dom;
		$this->destination=$destination;
		$this->ip=$ip;
		$this->iface=$iface;
	}
	function &write_xml() {
		$this->e_route=$this->dom->create_element('route');
		$this->e_route->set_attribute('destination', $this->destination);
		$e_iface=$this->dom->create_element('iface');
		$t_iface=$this->dom->create_text_node($this->iface);
		$e_iface->append_child($t_iface);
		$this->e_route->append_child($e_iface);
		$e_ip=$this->dom->create_element('ip');
		$t_ip=$this->dom->create_text_node($this->ip);
		$e_ip->append_child($t_ip);
		$this->e_route->append_child($e_ip);
		return $this->e_route;
	}
}

class interface {
	var $iface;
	var $ip;
	var $broadcast;
	var $netmask;
	
	var $mode;
	var $position;
	var $type;
	
	var $dom;
	var $e_interface;
	
	function &interface (&$dom, $iface, $ip, $broadcast, $netmask, $mode='', $position='', $type='') {
		$this->dom=& $dom;
		$this->iface=$iface;
		$this->ip=$ip;
		$this->broadcast=$broadcast;
		$this->netmask=$netmask;
		$this->mode=$mode;
		$this->position=$position;
		$this->type=$type;
	}
	
	function &write_xml() {
		$this->e_interface=$this->dom->create_element('interface');
		if ( $this->mode != '' )
		{
			$this->e_interface->set_attribute('mode', $this->mode);
		}
		if ( $this->position != '' )
		{
			$this->e_interface->set_attribute('position', $this->position);
		}
		if ( $this->type != '' )
		{
			$this->e_interface->set_attribute('type', $this->type);
		}
		$e_iface=$this->dom->create_element('iface');
		$t_iface=$this->dom->create_text_node($this->iface);
		$e_iface->append_child($t_iface);
		$this->e_interface->append_child($e_iface);
		$e_ip=$this->dom->create_element('ip');
		$t_ip=$this->dom->create_text_node($this->ip);
		$e_ip->append_child($t_ip);
		$this->e_interface->append_child($e_ip);
		$e_broadcast=$this->dom->create_element('broadcast');
		$t_broadcast=$this->dom->create_text_node($this->broadcast);
		$e_broadcast->append_child($t_broadcast);
		$this->e_interface->append_child($e_broadcast);
		$e_netmask=$this->dom->create_element('netmask');
		$t_netmask=$this->dom->create_text_node($this->netmask);
		$e_netmask->append_child($t_netmask);
		$this->e_interface->append_child($e_netmask);
		return $this->e_interface;
	}
}

$dom=domxml_new_doc('1.0');

$int_eth0=new interface($dom,'eth0', $HTTP_GET_VARS['front_ip'], $HTTP_GET_VARS['front_broadcast'], $HTTP_GET_VARS['front_netmask'],'master', 'front');
$int_eth1=new interface($dom,'eth1', $HTTP_GET_VARS['back_ip'], $HTTP_GET_VARS['back_broadcast'], $HTTP_GET_VARS['back_netmask'],'master', 'back');
$route=new route($dom,'default', $HTTP_GET_VARS['gateway'],'eth0');
$resolver=new resolver($dom, $HTTP_GET_VARS['nameserver'],$HTTP_GET_VARS['domain'],"");

$int_eth0=$int_eth0->write_xml();
$int_eth1=$int_eth1->write_xml();
$route=$route->write_xml();
$resolver=$resolver->write_xml();

$seb=array($int_eth0,$int_eth1);
$network=new network($dom,$seb,$route,$resolver);

$network=$network->write_xml();

/*
$zactivbox=new zactivbox($dom, "pssl", $network, $proxy);
$zactivbox->write_xml();

$dom->dump_file('./zactivbox.xml',false,true);
*/
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-31 08:44 UTC] moriyoshi@php.net
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
http://bugs.php.net/bugs-generating-backtrace.php

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.


 [2003-01-31 09:16 UTC] sebest at ovibes dot net
a much simple script to reproduce the crash , with a backtrace:

<?
/*
(gdb) bt
#0  0x408057fd in chunk_free () from /lib/libc.so.6
#1  0x408056c7 in free () from /lib/libc.so.6
#2  0x081692fb in zend_hash_del_key_or_index ()
#3  0x08167a88 in zend_unregister_functions ()
#4  0x08167bdc in module_destructor ()
#5  0x081694ee in zend_hash_clean ()
#6  0x0816962a in zend_hash_graceful_reverse_destroy ()
#7  0x0816501d in zend_shutdown ()
#8  0x08141496 in php_module_shutdown ()
#9  0x0817e041 in main ()
#10 0x407ab3c1 in __libc_start_main () from /lib/libc.so.6

*/
class resolver {
	var $domain;
	var $search;
	var $nameserver;
	
	var $dom;
	var $e_resolver;
	
	function resolver (&$dom, $nameserver, $domain='', $search='') {
		$this->dom=& $dom;
	}
	
	function &write_xml() {
	
		$this->e_resolver=$this->dom->create_element('resolver');
		return $this->e_resolver;
	}
}
$dom=domxml_new_doc('1.0');
$resolver=new resolver($dom, $HTTP_GET_VARS['nameserver'],$HTTP_GET_VARS['domain'],"");
$resolver=$resolver->write_xml();

$servers=array($int_eth0, $int_eth1);
$network=$dom->create_element('network');
$network->append_child($resolver);
?>
 [2003-01-31 14:35 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Unable to replicate using the latest CVS.
 [2003-02-13 19:47 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 06:01:35 2024 UTC