php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57976 dio_write does not work
Submitted: 2007-12-23 07:35 UTC Modified: 2016-12-25 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ullix at urkam dot de Assigned:
Status: No Feedback Package: dio (PECL)
PHP Version: 5.2.1 OS: kubuntu 7.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-12-23 07:35 UTC] ullix at urkam dot de
Description:
------------
downloaded dio package from cvs according to this page: http://de3.php.net/manual/en/install.pecl.downloads.php
and compiled shared PECL extensions with phpize according to this page: http://de3.php.net/manual/en/install.pecl.phpize.php

It completed with no errors.

resulting dio.so seems to function for all dio commands except dio_write, which always produces error and results in no write. Strange reference to a file descriptor which bears no relationship to the handle from open command


Reproduce code:
---------------
<?php
# create a file using "f" functions
$fhandle = fopen('test.txt','w+');
fwrite($fhandle,'0123456789_0123456789_0123456789_0123456789');
fclose($fhandle);

# now use dio functions
dl('dio.so');
$dhandle = dio_open('test.txt', O_CREAT | O_NONBLOCK,  O_RDWR);
echo "dio_handle:$dhandle, result from dio_read: ".dio_read($dhandle, 20);
$result = dio_write($dhandle, 'aaaaa_bbbbb_ccccc_ddddd_',12 );
dio_close($dhandle);



Actual result:
--------------
actual output:

dio_handle:Resource id #4, result from dio_read: 0123456789_012345678
Warning: dio_write() [function.dio-write]: cannot write data to file descriptor 10, Bad file descriptor in /home/ullix/dio_bug.php on line 12

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-25 18:54 UTC] msaraujo@php.net
I have reproduced the code in 5.2.5.
 [2008-09-18 01:15 UTC] chris at heathens dot co dot nz
Ummm, no, you are calling it with incorrect parameters.  It should be:

$dhandle = dio_open('test.txt', O_CREAT | O_NONBLOCK | O_RDWR, 0644);

Mode refers to the permission mode when creating the file, see open(2) man page.
 [2016-12-13 07:04 UTC] remi@php.net
-Status: Open +Status: Feedback
 [2016-12-13 07:04 UTC] remi@php.net
Does this still exists with latest 0.0.8 ?
 [2016-12-25 04:22 UTC] pecl-dev at lists dot php dot 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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 06:03:36 2021 UTC