Bug #78692 [Fbk->Asn]: define() and defined() not behaving correctly on Windows 10

From: Date: Sat, 19 Oct 2019 13:53:15 +0000
Subject: Bug #78692 [Fbk->Asn]: define() and defined() not behaving correctly on Windows 10
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223295@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78692&edit=1

 ID:                 78692
 User updated by:    security at paragonie dot com
 Reported by:        security at paragonie dot com
 Summary:            define() and defined() not behaving correctly on
                     Windows 10
-Status:             Feedback
+Status:             Assigned
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows
-PHP Version:        7.3.10
+PHP Version:        7.2.15
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Corrected.


Previous Comments:
------------------------------------------------------------------------
[2019-10-19 12:05:50] cmb@php.net

This is somewhat unlikely a Windows 10 specific issue.  Anyhow,
about which PHP version is it?  You've specified 7.3.10 in the
header, but stating the issue occured with 7.2.15.

------------------------------------------------------------------------
[2019-10-18 15:27:59] security at paragonie dot com

Description:
------------
Found upstream: https://github.com/paragonie/sodium_compat/issues/99

Apparently, when someone installs paragonie/certainty on a specific Windows setup (according to the
user, they are using "Win10 Enterprise 1809 and PHP 7.2.15 x64 NTS"), with sodium_compat
1.11.1, they were getting notices.

This _may_ be related to https://bugs.php.net/bug.php?id=77621 (not
guaranteed), but I'm having a frustrating time trying to reproduce this behavior (and failing
every time).

In the offchance that there is a Windows bug here (I assumed a race condition with the autoloader,
but that doesn't seem to be the cause), I wanted to make sure it's reported upstream.

Test script:
---------------
Add this to composer.json on the described environment:

"require": {
    "paragonie/certainty": "^2",
    "paragonie/sodium_compat": "1.11.1"
}

Then run composer install. Then run this:

<?php
use ParagonIE\Certainty\RemoteFetch;

$fetcher = new RemoteFetch('/path/to/certainty/data');
$latestCACertBundle = $fetcher->getLatestBundle();

$ch = curl_init('https://secure.php.net');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CAINFO, $latestCACertBundle->getFilePath());

If you get a bunch of E_WARNING errors, congratulations! You've reproduced it.

Expected result:
----------------
No output.

Actual result:
--------------
Lots of warnings that look like

PHP Warning:  constant(): Couldn't find constant ParagonIE_Sodium_Compat::CONSTANT_NAME in
C:\htdocs\www\testing\vendor\paragonie\sodium_compat\lib\php72compat.php on line 91




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78692&edit=1


Thread (15 messages)

« previous php.bugs (#223295) next »