#48307 [NEW]: stream_copy_to_stream() and sockets

2009-05-16 Thread lbarn...@php.net
From: lbarn...@php.net
Operating system: 
PHP version:  5.2.9
PHP Bug Type: Streams related
Bug description:  stream_copy_to_stream() and sockets

Description:

stream_copy_to_stream() copies 0 bytes when $source is a socket

Reproduce code:
---
$sockets = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);

fwrite($sockets[0], b"a");
stream_socket_shutdown($sockets[0], STREAM_SHUT_WR);

var_dump(stream_copy_to_stream($sockets[1], STDOUT));

Expected result:

int(1)
a

Actual result:
--
int(0)

-- 
Edit bug report at http://bugs.php.net/?id=48307&edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48307&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48307&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48307&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48307&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48307&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48307&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48307&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48307&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48307&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48307&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48307&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48307&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48307&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48307&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48307&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48307&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48307&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48307&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48307&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48307&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48307&r=mysqlcfg



#48309 [NEW]: stream_copy_to_stream() and fpasstru() do not update stream position

2009-05-17 Thread lbarn...@php.net
From: lbarn...@php.net
Operating system: 
PHP version:  5
PHP Bug Type: Streams related
Bug description:  stream_copy_to_stream() and fpasstru() do not update stream 
position

Description:

stream_copy_to_stream() and fpasstru() do not update stream position of
source stream, when source stream is a plain file.



Reproduce code:
---


Expected result:

te
string(2) "st"

Actual result:
--
te
string(4) "test"

-- 
Edit bug report at http://bugs.php.net/?id=48309&edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48309&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48309&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48309&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48309&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48309&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48309&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48309&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48309&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48309&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48309&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48309&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48309&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48309&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48309&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48309&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48309&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48309&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48309&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48309&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48309&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48309&r=mysqlcfg



[PHP-BUG] Bug #54384 [NEW]: FilterIterator crashes when constructor not called

2011-03-25 Thread lbarn...@php.net
From: 
Operating system: 
PHP version:  trunk-SVN-2011-03-25 (SVN)
Package:  SPL related
Bug Type: Bug
Bug description:FilterIterator crashes when constructor not called

Description:

FilterIterator instances crash when the constructor has not been called 

(accidentally).





Test script:
---
http://bugs.php.net/bug.php?id=54384&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54384&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54384&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=54384&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54384&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54384&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54384&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=54384&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=54384&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=54384&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=54384&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=54384&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=54384&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=54384&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54384&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=54384&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=54384&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=54384&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=54384&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=54384&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=54384&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=54384&r=mysqlcfg



[PHP-BUG] Bug #60139 [NEW]: Anonymous functions create cycles not detected by the GC

2011-10-26 Thread lbarn...@php.net
From: 
Operating system: 
PHP version:  5.4.0beta2
Package:  Performance problem
Bug Type: Bug
Bug description:Anonymous functions create cycles not detected by the GC

Description:

In the following Script 1 and Script 2, the created objects are not
destructed until the engine shutdowns because of a reference cycle.

The objects hold a reference to an anonymous function that itself hold a
reference to the object.

It seems that the garbage collector is unable to break the cycle.

Script 3 doesn't leak memory because the anonymous function doesn't hold a
reference to the object.

Test script:
---
# Script 1 (leaks with php5.4)

x = function() {};
}
}

echo memory_get_usage(), "\n";

for ($i = 0; $i < 1000; ++$i) {
new Foo;
}
gc_collect_cycles();

echo memory_get_usage(), "\n";
?>

# Script 2 (leaks with php5.3)

x = function() use ($self) {};
}
}

echo memory_get_usage(), "\n";

for ($i = 0; $i < 1000; ++$i) {
new Foo;
}
gc_collect_cycles();

echo memory_get_usage(), "\n";

?>

# Script 3 (no leak)

x = get_fun();
}
}

function get_fun() {
return function() {};
}

echo memory_get_usage(), "\n";

for ($i = 0; $i < 1000; ++$i) {
new Foo;
}
gc_collect_cycles();

echo memory_get_usage(), "\n";
?>

Expected result:

Memory usage before and after is approximatel the same:

121040
121152

Actual result:
--
Objects are never freed and memory usage increases:

120724
417640

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60139&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60139&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60139&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60139&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60139&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60139&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60139&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60139&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60139&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60139&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60139&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60139&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60139&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60139&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60139&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60139&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60139&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60139&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60139&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60139&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60139&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60139&r=mysqlcfg