Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #36813 : DOMDo***ent::removeChild corrupts node
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th May 10:47
php-bugs
External User
 
Posts: 1
Default #36813 : DOMDo***ent::removeChild corrupts node



ID: 36813
User updated by: olaf at 7val dot com
-Summary: curl_close causes segfault when accessing members in
object
Reported By: olaf at 7val dot com
-Status: Feedback
+Status: Open
Bug Type: cURL related
Operating System: Linux
PHP Version: 5.1.2
New Comment:

CVS sanpshot works fine for me


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

[2006-03-21 15:38:46] iliaa@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5.1-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.1-win32-latest.zip

Appears to work fine in latest CVS.

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

[2006-03-21 14:10:37] olaf at 7val dot com

Description:
------------
curl_close causes a segfault when accessing a member variable after the
call (see code below) when CURLOPT_RETURNTRANSFER is true and
CURLOPT_HEADERFUNCTION is set to a member function.

Calling
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION,array(&$this,
'readHeader'));

again in __destruct (before curl_close) makes the segfault go away.

Adding the line:
zval_copy_ctor(ch->handlers->write_header->func_name);
in ext/curl/interface.c line 1152 seems to fix it, but I don't know if
it produces a memory leak.

Reproduce code:
---------------
<?php

class CurlTest {
var $curl;
var $url;

function readHeader($ch, $data)
{
return strlen($data);
}

function __construct($url)
{
$this->curl = curl_init($url);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(&$this,
'readHeader'));
curl_setopt($this->curl, CURLOPT_URL, $url);
$this->url = $url;
}

function __destruct()
{
if (is_resource($this->curl)) {
curl_close($this->curl);
}
$x = $this->url;
}

function exec()
{
curl_exec($this->curl);
}
}


$t = new CurlTest('http://www.google.de');
$t->exec();
$t = null;

?>


Expected result:
----------------
No segfault

Actual result:
--------------
Segfault


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


--
Edit this bug report at http://bugs.php.net/?id=36813&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666