From e2402cfde2b2822a63b7003666973a6171df419c Mon Sep 17 00:00:00 2001 From: Sander van Dragt Date: Thu, 14 May 2026 14:41:27 +0100 Subject: [PATCH] Fix: save_profile_settings drops every site after the first on PHP 8 The inner loop body reassigned $options via array_keys(), shadowing the outer foreach's $options binding. After the first site iteration the variable became a numerically-indexed array, so subsequent calls to in_array($value, $options) compared strings like 'all' against ints like 0 and 1. PHP 7 loose-equated those via int cast (true); PHP 8 reversed the rule to cast the int to string instead, so the check fails and every site after the first is silently skipped. Use a fresh local ($valid_values) and switch to a strict in_array(). Verified on PHP 8.3: profile-page save now persists for all sites in the network table, not just the first. Co-Authored-By: Claude Opus 4.7 (1M context) --- library/Falcon/Connector.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/Falcon/Connector.php b/library/Falcon/Connector.php index cc5209c..2726e59 100644 --- a/library/Falcon/Connector.php +++ b/library/Falcon/Connector.php @@ -168,9 +168,13 @@ public function save_profile_settings( $user_id, $args = array(), $sites = null } $value = $args[ $request_key ]; - // Check the value is valid - $options = array_keys( $options ); - if ( ! in_array( $value, $options ) ) { + // Check the value is valid. + // Use a fresh local so we don't mutate the outer foreach's $options — + // on subsequent sites that would leave $options as a numeric-indexed + // list, and on PHP 8+ in_array() with non-numeric strings against ints + // no longer loose-equates, so all sites after the first silently skip. + $valid_values = array_keys( $options ); + if ( ! in_array( $value, $valid_values, true ) ) { continue; }