From: security at paragonie dot com
Operating system: Windows
PHP version: 7.3.10
Package: *General Issues
Bug Type: Bug
Bug description:define() and defined() not behaving correctly on Windows 10
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 bug report at https://bugs.php.net/bug.php?id=78692&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78692&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78692&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78692&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78692&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78692&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78692&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78692&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78692&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78692&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78692&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78692&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78692&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78692&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78692&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78692&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78692&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78692&r=mysqlcfg