php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49645 dio_open parameters are incorrect
Submitted: 2009-09-23 16:46 UTC Modified: 2009-09-29 05:51 UTC
From: mbarlocker at soleranetworks dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.3.0 OS:
Private report: No CVE-ID: None
 [2009-09-23 16:46 UTC] mbarlocker at soleranetworks dot com
Description:
------------
The arguments for this function are incorrect. You will not notice this until you try to use dio_open and then dio_write. You will get this error on the console: 'Bad file descriptor'.

the 'flags' parameter MUST include one of {O_RDONLY, O_WRONLY, O_RDWR}. It may also include any combination of the flags listed.

the 'mode' parameter is NOT the read/write mode. It is the permissions of the file. For example 0644 or 0755. Notice that there are not quotes around these permissions.

This works correctly on Fedora 10 x86_64 php 5.2.9.

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

$fd = dio_open('output', O_CREAT | O_TRUNC, O_WRONLY);
dio_write($fd, 'this is the output.');
dio_close($fd);

?>

Expected result:
----------------
write 'this is the output.' to ./output

Actual result:
--------------
PHP Warning:  dio_write(): cannot write data to file descriptor 0, Bad file descriptor in /home/mbarlocker- on line 4


ls -la
---------x  1 mbarlocker mbarlocker     0 2009-09-23 10:46 output


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-29 05:51 UTC] svn@php.net
Automatic comment from SVN on behalf of torben
Revision: http://svn.php.net/viewvc/?view=revision&revision=288931
Log: Several grammatical fixes and some factual corrections.
Corrected the documentation of the mode param (addresses bug #49645).
 [2009-09-29 05:51 UTC] torben@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 06:00:01 2026 UTC