php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48326 socket_recvfrom and socket_recv constant MSG_DONTWAIT not defined
Submitted: 2009-05-19 04:56 UTC Modified: 2021-11-10 12:13 UTC
Votes:18
Avg. Score:4.2 ± 1.0
Reproduced:15 of 15 (100.0%)
Same Version:10 (66.7%)
Same OS:12 (80.0%)
From: VJTD3 at VJTD3 dot com Assigned: cmb (profile)
Status: Closed Package: Sockets related
PHP Version: 5.*, 6CVS (2009-05-19) OS: *
Private report: No CVE-ID: None
 [2009-05-19 04:56 UTC] VJTD3 at VJTD3 dot com
Description:
------------
socket_recvfrom and socket_recv function flag of the constant MSG_DONTWAIT are not defined.



Reproduce code:
---------------
print (defined(MSG_DONTWAIT) ? 'defined:'.constant(MSG_DONTWAIT) : 'not defined');

Expected result:
----------------
'defined:' and the value of the constant MSG_DONTWAIT

Actual result:
--------------
not defined

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-19 05:00 UTC] VJTD3 at VJTD3 dot com
print (defined('MSG_DONTWAIT') ? 'defined:'.constant('MSG_DONTWAIT') : 'not defined');

just a typo fix in the example, missed the ', it's a bug just a typo in my example.
 [2009-05-19 10:43 UTC] jani@php.net
AFAICT, this is not really a bug since that constant has never existed. I guess Arnaud is going to add it..:)
 [2009-05-19 12:00 UTC] lbarnaud@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Added MSG_DONTWAIT constant in HEAD (php6), it will be defined if the system provides it.
stream_set_blocking() should be used if not.
 [2009-05-19 12:07 UTC] lbarnaud@php.net
To be documented: MSG_DONTWAIT added in PHP 6.
 [2009-05-19 18:53 UTC] VJTD3 at VJTD3 dot com
just a workaround, defining it manually or passing 0x40 directly will solve the problem till the release.
 [2009-05-20 09:09 UTC] lbarnaud@php.net
Added to 5.2/5.3.

To be documented: Since PHP 5.2.10; If system supports it.
 [2009-07-24 21:20 UTC] register at brekerbohm dot net
On Windows Systems it still don't work. I use PHP 5.3 and I can't work really well so. I've hard problems because of that.
Is there any solution?

If I use the Testcode above ( print (defined('MSG_DONTWAIT') ? 'defined:'.constant('MSG_DONTWAIT') : 'not defined'); ) it prints not defined.
 [2009-08-25 00:19 UTC] VJTD3 at VJTD3 dot com
<?php

 function workaround() {
  if (!defined('MSG_DONTWAIT')) {
   define('MSG_DONTWAIT', 0x40);
   return 1;
  }
 }
 workaround();

?>

workaround... return 1 if it was used... maybe useful for some kinda debug... also the Compat Project
 [2021-11-10 12:13 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-11-10 12:13 UTC] cmb@php.net
Apparently, it has been forgotten to close this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC