Nice, I've been a huge fan of Paragon Initiative but haven't used any of their libraries since libsodium became part of the core.
We are currently in the process of rotating to HybridKem scheme (ECC/KEM) but in order to do so we made a wrapper around liboqs. (made it public available in case anyone is intrested (https://github.com/secudoc/php-liboqs) However I am tempted to replace it with this one.
We used FFI with liboqc to provide PQC, eventually we wrote an extension for this lib. No idea how long we'd still need this with OpenSSL 3.5+ supporting PQC. Not much of a heaven/horror story but I can imagine that it is going to be annoying when the headers change
It was indeed a linker problem, even thought the ./configure said it found libsodium-1.0.13. I still had the vendor library installed (1.0.8-5) (/usr/lib). I uninstalled that one first, reinstalled 1.0.13 (/usr/local/lib) and it worked properly.
I restarted the build process and reverted back to OpenSSL 1.0.1f. Without the --with-sodium flag the build runs just fine.
When I try the --with-sodium and libsodium-1.0.13 installed it gives me:
In function `zm_startup_sodium':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:464: undefined reference to `crypto_pwhash_opslimit_interactive'
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:466: undefined reference to `crypto_pwhash_memlimit_interactive'
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:468: undefined reference to `crypto_pwhash_opslimit_moderate'
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:470: undefined reference to `crypto_pwhash_memlimit_moderate'
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:472: undefined reference to `crypto_pwhash_opslimit_sensitive'
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:474: undefined reference to `crypto_pwhash_memlimit_sensitive'
ext/sodium/.libs/libsodium.o: In function `zif_sodium_crypto_pwhash':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:1831: undefined reference to `crypto_pwhash'
ext/sodium/.libs/libsodium.o: In function `zif_sodium_crypto_pwhash_str':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:1875: undefined reference to `crypto_pwhash_str'
ext/sodium/.libs/libsodium.o: In function `zif_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:2362: undefined reference to `crypto_aead_xchacha20poly1305_ietf_encrypt'
ext/sodium/.libs/libsodium.o: In function `zif_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:2431: undefined reference to `crypto_aead_xchacha20poly1305_ietf_decrypt'
ext/sodium/.libs/libsodium.o: In function `zif_sodium_crypto_pwhash_str_verify':
/usr/local/src/php-7.2.0beta2/ext/sodium/libsodium.c:1912: undefined reference to `crypto_pwhash_str_verify'
collect2: error: ld returned 1 exit status
Makefile:311: recipe for target 'sapi/fpm/php-fpm' failed
make: *** [sapi/fpm/php-fpm] Error 1
Anyone managed to compile this on Ubuntu 16.04? I'm running into way to many SSL problems if I enable libsodium. Trying to compile with a newer version of libsodium and openssl works for libsodium but it starts giving problems elsewere regarding other tools being build with a different Openssl version.
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libc-client.a(osdep.o): undefined reference to symbol 'SSL_CTX_set_tmp_rsa_callback@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
Not to mention that there is also a serious issue with the MongoDB driver + PHP 7 + opcache enabled. Queries tend to loose their structure after an x amount of calls. https://github.com/mongodb/mongo-php-library/issues/216
[Mon Oct 08 12:20:49 2012] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /var/www/x/xhprof/classes/data.php:257\nStack trace:\n#0 /var/www/x/xhprof/classes/data.php(257): PDOStatement->execute()\n#1 /var/www/x/inc/append.php(25): ay\xhprof\Data->save(Array)\n#2 [internal function]: {closure}()\n#3 {main}\n thrown in /var/www/x/xhprof/classes/data.php on line 257
[Mon Oct 08 11:33:41 2012] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /var/www/x/xhprof/classes/data.php:255\nStack trace:\n#0 /var/www/x/xhprof/classes/data.php(255): PDOStatement->execute()\n#1 /var/www/x/inc/append.php(25): XHProf\Data->save(Array)\n#2 [internal function]: {closure}()\n#3 {main}\n thrown in /var/www/x/xhprof/classes/data.php on line 255
changed the following in append.php:
$xhprof_data_obj = new XHProf\Data($config['pdo']);
to
$xhprof_data_obj = new \ay\XHProf\Data($config['pdo']);
reason for this is the following error:
[Mon Oct 08 11:30:12 2012] [error] [client 127.0.0.1] PHP Fatal error: Class 'XHProf\Data' not found in /var/www/x/inc/append.php on line 24
edit:
The problem with this function is that the requested length can only be as long as the charset. The second problem is that you never get duplicate characters unless there are duplicates in the charset. The upside is: it's much faster than the other code snippets.
I did exactly the same a week ago. An end of an era, thank you JetBrains for PHPStorm, there was nothing like it.
I switched to T3 Code from Claude Code / Codex
Good feature!
Supply chain attacks, quite the popular attack these days.. I'm always scared installing updates yet I live for updating my composer packages ;)
Nice, I've been a huge fan of Paragon Initiative but haven't used any of their libraries since libsodium became part of the core.
We are currently in the process of rotating to HybridKem scheme (ECC/KEM) but in order to do so we made a wrapper around liboqs. (made it public available in case anyone is intrested (https://github.com/secudoc/php-liboqs) However I am tempted to replace it with this one.
We used FFI with liboqc to provide PQC, eventually we wrote an extension for this lib. No idea how long we'd still need this with OpenSSL 3.5+ supporting PQC. Not much of a heaven/horror story but I can imagine that it is going to be annoying when the headers change
Shit. I missed it.
It was indeed a linker problem, even thought the ./configure said it found libsodium-1.0.13. I still had the vendor library installed (1.0.8-5) (/usr/lib). I uninstalled that one first, reinstalled 1.0.13 (/usr/local/lib) and it worked properly.
Thanks for the help
Thank you!
I restarted the build process and reverted back to OpenSSL 1.0.1f. Without the --with-sodium flag the build runs just fine.
When I try the --with-sodium and libsodium-1.0.13 installed it gives me:
Anyone managed to compile this on Ubuntu 16.04? I'm running into way to many SSL problems if I enable libsodium. Trying to compile with a newer version of libsodium and openssl works for libsodium but it starts giving problems elsewere regarding other tools being build with a different Openssl version.
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libc-client.a(osdep.o): undefined reference to symbol 'SSL_CTX_set_tmp_rsa_callback@@OPENSSL_1.0.0' //lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
Anyone got a proper build flow?
Include a header in your request containing the accesstoken instead of relying on session cookies. Take a look at oAuth2.
Not to mention that there is also a serious issue with the MongoDB driver + PHP 7 + opcache enabled. Queries tend to loose their structure after an x amount of calls. https://github.com/mongodb/mongo-php-library/issues/216
I like it! This was on my todo list to make actually, especially the scheduled part. Good replacement for gearman it seems
If you want to test API's, perhaps BDD is the way to go? Try Behat
Guess it's time to retire the FizzBuzz Challenge on phpgolf now.. ;)
Heh There's but one function that I implemented on a User object:
hasGodComplex()
Basically userlevel check.
+1 for using Varnish, more people should do that.
No, if the GET parameter contains a number and the query treats it as such, mysqli_real_escape_string wont do you any good.
Example:
if the get value would be: 1 OR 1=1 it would still delete everything.
Now if all your queries look like:
, note the quotes around $my_value I believe it would not be a problem (using mysqli_real_escape_string that is ofcourse)
Anyway I suggest you get your prepared statements up and running asap..
closing the cursors seems to get rid of the error, except I still get a: Unexpected system behaviour.
Yes I am using MySQL, the problem still exists after reinstalling the db schema.
Still get the PDO exception:
[Mon Oct 08 12:20:49 2012] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /var/www/x/xhprof/classes/data.php:257\nStack trace:\n#0 /var/www/x/xhprof/classes/data.php(257): PDOStatement->execute()\n#1 /var/www/x/inc/append.php(25): ay\xhprof\Data->save(Array)\n#2 [internal function]: {closure}()\n#3 {main}\n thrown in /var/www/x/xhprof/classes/data.php on line 257
oh I did clone the project, must have been updated in the mean while, I'll check it out.
Got a bunch of errors,
[Mon Oct 08 11:33:41 2012] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /var/www/x/xhprof/classes/data.php:255\nStack trace:\n#0 /var/www/x/xhprof/classes/data.php(255): PDOStatement->execute()\n#1 /var/www/x/inc/append.php(25): XHProf\Data->save(Array)\n#2 [internal function]: {closure}()\n#3 {main}\n thrown in /var/www/x/xhprof/classes/data.php on line 255
changed the following in append.php:
$xhprof_data_obj = new XHProf\Data($config['pdo']);
to
$xhprof_data_obj = new \ay\XHProf\Data($config['pdo']);
reason for this is the following error:
[Mon Oct 08 11:30:12 2012] [error] [client 127.0.0.1] PHP Fatal error: Class 'XHProf\Data' not found in /var/www/x/inc/append.php on line 24
Haven't looked into the database problem yet
Generators! must...... have.....
Slightly modified to make it work 'properly' with 2007-, or -3021. Performancewise it could be better ;)
Something in the lines of:
edit: The problem with this function is that the requested length can only be as long as the charset. The second problem is that you never get duplicate characters unless there are duplicates in the charset. The upside is: it's much faster than the other code snippets.