-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with latest version and missing constants #99
Comments
Yes! :) Let's start with: What operating system are you using? There might be something weird with your OS-provided packages that's creating this behavior. |
I am using Win10 Enterprise 1809 and PHP 7.2.15 x64 NTS. I am running this in IIS, for a WordPress installation, for development purposes. The correct Version of PHP is specified in my PATH and in IIS (site and server). |
Quick fix: Open I'll look into reproducing this issue and report back as soon as I'm aware of what's happening. |
Okay, this might solve the problem: 76d239d If the class doesn't exist, |
If you'd like to help confirm the fix: Replace If so, I'll release |
Actually, that might have been premature. Sorry. You'll want this file instead. The previous one works locally but not when installed as a dependency. |
Not sure how to force the autoloader to run first, I use composer and standard using statements (does the order of using statements change the order of class-loading?) Not sure how composer works under the hood really. I can test that file in a little bit. |
It does! But also, it shouldn't matter at all. The autoloader should be registered before
There's nothing you have to do. That's my responsibility. :) |
Tested that version, and it still throws the mentioned warnings. Hmm. I am quite stumped. This development will eventually be deployed to a shared hosting environment, so I wouldn't be able to rely on a php ini change. Is there any other info I could provide? |
This tells me: The autoloader isn't working. I wonder if I have to hijack Composer's? |
In if (DIRECTORY_SEPARATOR === '\\') {
assert(ParagonIE_Sodium_Compat::polyfill_is_fast());
} The line that follows should be: require_once dirname(__FILE__) . '/lib/php72compat.php' |
Assert that the class exists before attempting to load lib/php72compat.php.
I've thus far been unsuccessful in reproducing the issues in my own environments. One trick you might want to try is to check |
Which autoload? The one under sodium_compat or, the one under vendor? |
I have seen that method before in the documentation. Doesn't this method just check if sodium will be efficiently ran? |
In order for this to return anything, it has to guarantee that |
Under vendor. Specifically, |
Hmm, how is that line actually ran from a separate PHP file? Do I have to load the right file, in a "using" statement to get access to that? Hmm, how is that file generally invoked? Is that autoload file picked up by composer, and then invoked when a "using" statement is present in a php file? |
The answer is in the composer configuration: Line 50 in 63c4a80
The hotfix I provided above should guarantee that If you are still getting errors, then the problem is unrelated to race conditions with the autoloader. In that case, it might be some weird Windows bug that needs to be reported to the PHP team. |
Ahhhh, so each "dependency" does/can have a composer.json that dictates how the dependency is to be loaded? Sorry if this is basic, haven't delved too much into how composer works, just that I know how to use it |
I have the same problem. The issue is that it can't read the constants within the class. Removing the loop and placing the following in my code fixes the problem in php72compat.php:
const does not throw an error if it is already defined. |
Yes, but can |
its only included if its php 7.x anyway? |
This is the first time i've tried this library, and it didn't work. Just sharing my fix, i really want to get on with trying out ECC in php. |
This should work, then. |
Okay, update to |
Ok, i have updated and can confirm it works on PHP 7.1 on Windows 10 / WAMP 7.1 Thank you. |
Hmm, I still encounter an issue. I've made sure to regenerate my autoloader, and have updated to the latest for sodium_compat and certainty. All the constants seem to be defined already. What can I provide to help?
|
For the using statement, I use Certainty with this using:
Is there a different one that should be used? |
That's a different error! We're moving in the right direction. Try version |
(Apologies for anyone not participating in this thread. I can only use releases to guarantee complex fixes are deployed in these users' computers since I cannot reproduce the issue on my own computers.) |
Closer ;) Complains differently about all the constants ;) Warning: constant(): Couldn't find constant ParagonIE_Sodium_Compat::BASE64_VARIANT_ORIGINAL in D:\inetpub\wwwroot...\vendor\paragonie\sodium_compat\lib\php72compat.php on line 93 |
What happens if you run |
No output from command line (assuming success because no warnings given) |
Okay, I think I know the issue. Run these two commands in a few minutes and it should force-update to
If it doesn't update, you might need to delete |
Just to let you know, updated and it still works for me. |
Seems to have fixed it. Odd, because I deleted the vendor folder before. Must have been some leftover files in my project that I didn't delete. Now on to the certainty issues the seem to linger. |
I'll close this for now, as it seems to be fixed, nd my issue is another area now. Thanks for all your help, it is much appreciated! |
Happy to hear that! |
I think this may be the result of https://bugs.php.net/bug.php?id=77621 since it was fixed in PHP 7.2.16 (see COM). |
Nice find! It DOES seem connected. Sadly, our environment has to match production, and they use PHP 7.2.15. They'll update eventually ;) Thanks for the update on this; it is very much appreciated! |
Actually, that might not be related. I opened https://bugs.php.net/bug.php?id=78692 just in case it is a new PHP bug. |
The COM bug is definitely unrelated, but I wonder whether OPcache was enabled when the problems occured, and whether disabling OPcache would have solved the issue. |
PHP 7.x is pretty buggy especially the .1 and .2 branches in experience, the whole reason why .3 was created. |
I currently cannot update versions of this library, and am stuck on v1.8.1.
If I update to 1.11.1, then the file "php72compat.php" fails to find the correct constants passed to "constant()"
This issue will then generate a warning for EVERY constant needed, even if my PHP version is v7.1 or v7.2.
Can this be investigated?
I can reproduce it by using Certainty, and updating to the latest, and then trying to execute RemoteFetch->getLatestBundle().
The text was updated successfully, but these errors were encountered: