Skip to:
Content

BuddyPress.org

Opened 9 months ago

Closed 5 weeks ago

Last modified 5 weeks ago

#9008 closed defect (bug) (invalid)

PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in class-bp-signup.php

Reported by: btray900's profile btray900 Owned by: espellcaste's profile espellcaste
Milestone: Priority: normal
Severity: normal Version: 11.3.1
Component: WP CLI BP Keywords: needs-patch
Cc:

Description

PHP Version: 8.1.2
WP Version: 6.3.2
BP Version: 11.3.1

Using the wp bp signup create CLI, a type error is throw for the meta array.

wp bp signup create --user-login=amthompson23 --user-email=amthompson23@email.com.com --path=/var/www/legacy/wordpress

PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /var/www/legacy/wordpress/wp-content/plugins/buddypress/bp-members/classes/class-bp-signup.php:469
Stack trace:
#0 /var/www/legacy/wordpress/wp-content/plugins/buddypress/cli/src/signup.php(106): BP_Signup::add()
#1 [internal function]: Buddypress\CLI\Command\Signup->create()
#2 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#3 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(431): WP_CLI\Dispatcher\Subcommand->invoke()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(454): WP_CLI\Runner->run_command()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1269): WP_CLI\Runner->run_command_and_exit()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process()
#10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#11 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('...')
#12 /usr/local/bin/wp(4): include('...')
#13 {main}
  thrown in /var/www/legacy/wordpress/wp-content/plugins/buddypress/bp-members/classes/class-bp-signup.php on line 469

Diff:

diff --git a/src/bp-members/classes/class-bp-signup.php b/src/bp-members/classes/class-bp-signup.php
index 26c12b756..0e043b6ce 100644
--- a/src/bp-members/classes/class-bp-signup.php
+++ b/src/bp-members/classes/class-bp-signup.php
@@ -480,10 +480,10 @@ class BP_Signup {
                );
 
                // Ensure that sent_date and count_sent are set in meta.
-               if ( ! isset( $r['meta']['sent_date'] ) ) {
+               if ( is_array($r['meta']) && ! isset( $r['meta']['sent_date'] ) ) {
                        $r['meta']['sent_date'] = '0000-00-00 00:00:00';
                }
-               if ( ! isset( $r['meta']['count_sent'] ) ) {
+               if ( is_array($r['meta']) && ! isset( $r['meta']['count_sent'] ) ) {
                        $r['meta']['count_sent'] = 0;
                }

Change History (3)

#1 @btray900
9 months ago

After diff applied from CLI. No issues with GUI before or after the changes.

wp bp signup create --user-login=amthompson23 --user-email=amthompson23@email.com --path=/var/www/legacy/wordpress

Success: Successfully added new user signup (ID #2).

#2 @espellcaste
6 weeks ago

  • Component changed from Members to WP CLI BP
  • Milestone changed from Awaiting Review to Up Next
  • Owner set to espellcaste

#3 @espellcaste
5 weeks ago

  • Milestone Up Next deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

I can't replicate the issue in the latest version of BP. Since the suggestion here would be to update BuddyPress, let's resolve this ticket as invalid.

Last edited 5 weeks ago by espellcaste (previous) (diff)
Note: See TracTickets for help on using tickets.