Undefined array key 2
I am still seeing errors in the error log.
I use another plugin , WP User Frontend , to enable posting simple status messages from the site front-end , usually this happens instantly , since installing the NOSTR plugin this now takes a long time , sometimes failing.
2023/06/12 07:35:21 [error] 81785#81785: *552 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key 2 in /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/nostrtium/vendor/swentel/nostr-php/src/Relay/CommandResult.php on line 38; PHP message: PHP Fatal error: Uncaught ErrorException: Creation of dynamic property WPUF_Form::$data is deprecated in /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/wp-user-frontend/includes/class-form.php:22
Stack trace:
#0 /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/wp-user-frontend/includes/class-form.php(22): Phrity\Util\ErrorHandler->Phrity\Util\{closure}()
#1 /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/wp-user-frontend/class/subscription.php(634): WPUF_Form->__construct()
#2 /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-includes/class-wp-hook.php(308): WPUF_Subscription->post_redirect()
#3 /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#4 /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/wp-user-frontend/incl" while reading response header from upstream, client: 192.168.0.118, server: mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion, request: "POST /wp-admin/admin-ajax.php HTTP/1.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion", referrer: "http://mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/"
2023/06/12 11:42:09 [error] 81786#81786: *3833 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key 2 in /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/nostrtium/vendor/swentel/nostr-php/src/Relay/CommandResult.php on line 38" while reading response header from upstream, client: 192.168.0.111, server: mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion, request: "POST /xmlrpc.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion"
2023/06/12 18:35:21 [error] 81786#81786: *7705 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key 2 in /var/www/mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/wp-content/plugins/nostrtium/vendor/swentel/nostr-php/src/Relay/CommandResult.php on line 38" while reading response header from upstream, client: 192.168.0.121, server: mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion, request: "POST /wp-admin/admin-ajax.php HTTP/1.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion", referrer: "http://mwaters7eu2pyfcz36oehlc3htnqarakd7meeyz4lvbubff64ethxzqd.onion/category/status/"
Today I removed all but a few relays from the Nostrtium list and although Front-Page posting is slower , it works and there are no errors in the error log.
Back from travel and will try to get to this as soon as i get caught up on other pressing things.
Yeah, I hadn’t really thought through all of the implications of doing the auto-posting thing. When you post to nostr from the post page the way the plugin was originally designed (before adding the auto-post feature), it throws up a modal that lets you see that it’s doing something that takes some time. But when it is auto-posting, it has to do all that stuff in the background and I hadn’t thought about that enough. I’m going to have to implement an asynchronous process for looping through and posting to each relay so that it doesn’t hold up the whole WP posting action.
@markwaters I've spent some time over the last couple days working on setting up background, asynchronous sending for nostrtium. I think that’s the way to go for both auto-publish and posting from the metabox in the post editor too.
i found a nice framework for queuing up background operations but it’s a little complicated pulling it into nostrtium as a dependency in a clean way and I'm trying to work that out.
very unfortunately though, as i was looking around at all of the plugin’s dependencies, i discovered that the author of the main php-nostr library that the plugin depends on has recently determined that he doesn’t have time to maintain the project and is looking for someone else to take it over. If nobody does (i can’t - also not enough time), that’s going to be a blow to nostrtium that might make me re-think how it works altogether.
an alternative way to do all the nostr plumbing stuff would be to pull in javascript libraries (instead of php) and do all the nostr note construction and sending in the browser with js instead of on the server with php. I thought about doing it that way in the first place but preferred to use php if possible to be more wordpress-ish (and also because i am more experienced with php than with javascript).
I’m afraid if i have to pivot to using js libraries and doing everything in the browser that one likely side-effect of that is that the background auto-post functionality may have to go because the way that is happening is (and i think has to be) independent of a browser and that means no javascript environment for any code to run in.
no conclusions about any of this yet. But this is where things are with resolving this issue at the moment.
The ActivityPub plugin sends out using the wordpress cron functionality , could that be used by Nostrtium too ?
@Coding what is difference between code security and code quality in order to align with code of universe rather than user interface to mitigate the frequency of bug fixing?