Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.1

Bug #20434 constant OS_WINDOWS is not defined
Submitted: 2014-10-30 01:20 UTC
From: welles1941 Assigned: welles1941
Status: Closed Package: Net_Socket2 (version 0.1.0)
PHP Version: 5.6.2 OS: Linux
Roadmaps: (Not assigned)    

 [2014-10-30 01:20 UTC] welles1941 (Bill Bryant)
Description: ------------ The constant OS_WINDOWS is referenced on line 387 in Socket2.php, but is not defined. This constant is defined in PEAR.php which is not included. Either including PEAR.php or checking if the constant is defined before referencing it would fix the issue. Test script: --------------- <?php require_once 'Mail2.php'; $mail = Mail2::factory('smtp', array( 'host' => 'smtp.myserver', 'persist' => true )); $headers = array( 'Subject' => 'Hello!', 'From' => '' ); $mail->send('', $headers, 'Hello!'); Expected result: ---------------- Script executes without errors or warnings. Actual result: -------------- Notice: Use of undefined constant OS_WINDOWS - assumed 'OS_WINDOWS' in /usr/share/pear/Net/Socket2.php on line 387


 [2014-10-30 01:24 UTC] welles1941 (Bill Bryant)
 [2014-10-30 01:25 UTC] welles1941 (Bill Bryant)
 [2014-10-30 02:07 UTC] welles1941 (Bill Bryant)
 [2014-10-30 02:09 UTC] welles1941 (Bill Bryant)
 [2014-10-30 02:18 UTC] welles1941 (Bill Bryant)
Actually, it would probably be more accurate to check PHP_OS in the same way that the value of OS_WINDOWS is derived (see Socket2-checkOS.patch). Just checking whether it's defined doesn't help as it doesn't prevent the code from running on Windows when it shouldn't. It does seem somewhat inefficient, however, to check this every time, since the value doesn't change. Maybe it's better to define it as a constant?
 [2015-03-23 19:39 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: welles1941
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.