Bug #20434 [Com]: constant OS_WINDOWS is not defined

From: Date: Wed, 29 Oct 2014 22:18:46 +0000
Subject: Bug #20434 [Com]: constant OS_WINDOWS is not defined
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-11110@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=20434&edit=1 ID: 20434 Comment by: welles1941@gmail.com Reported By: welles1941 at gmail dot com Summary: constant OS_WINDOWS is not defined Status: Open Type: Bug Package: Net_Socket2 Operating System: Linux Package Version: 0.1.0 PHP Version: 5.6.2 Roadmap Versions: New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [2014-10-29 22:09:43] welles1941 Added #patch bug:20434;patch:Socket2-checkOS.patch;revision:1414620583;. ------------------------------------------------------------------------ [2014-10-29 22:07:58] welles1941 Added #patch bug:20434;patch:Socket2-checkOS.patch;revision:1414620478;. ------------------------------------------------------------------------ [2014-10-29 21:25:16] welles1941 Added #patch bug:20434;patch:Socket2-checkConst.patch;revision:1414617916;. ------------------------------------------------------------------------ [2014-10-29 21:24:30] welles1941 Added #patch bug:20434;patch:Socket2-requirePEAR.patch;revision:1414617870;. ------------------------------------------------------------------------ [2014-10-29 21:20:48] welles1941 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' => 'me@example.com' ); $mail->send('me@example.com', $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 ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=20434&edit=1

« previous php.pear.bugs (#11110) next »