From: kaz at e-2 dot co dot jp
Operating system: *
PHP version: 5.2.6
PHP Bug Type: Streams related
Bug description: stream_lock call with wrong paramater
Description:
------------
When i regist my own stream class, and use flock($h, LOCK_UN).
then steam_lock caled with undefined mode(0x8).
php-5.2.6/ext/standard/file.c
----
321 static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN };
snip...
348 act = flock_values[act - 1] | (operation & 4 ? LOCK_NB : 0);
349 if (php_stream_lock(stream, act)) {
Reproduce code:
---------------
<?php
class StreamTest
{
function stream_open($path, $mode, $options, &$opened_path) {
return true;
}
function stream_close() {
return ;
}
function stream_lock($mode) {
printf( "0x%x\n", $mode ) ;
return ;
}
}
stream_register_wrapper("streamtest", "StreamTest");
$handle = fopen( 'streamtest://test', "r" ) ;
flock( $handle, LOCK_EX ) ;
flock( $handle, LOCK_UN ) ;
fclose($handle) ;
Expected result:
----------------
0x2
0x3
Actual result:
--------------
0x2
0x8
--
Edit bug report at http://bugs.php.net/?id=46673&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46673&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46673&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46673&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46673&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46673&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46673&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46673&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46673&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46673&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46673&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46673&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46673&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46673&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46673&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46673&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46673&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46673&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46673&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46673&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46673&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46673&r=mysqlcfg