From 687835771c015fa74b297b943cf47207256b6bce Mon Sep 17 00:00:00 2001 From: Sebastian Pedersen Date: Wed, 3 Sep 2025 21:50:53 -0700 Subject: [PATCH] `gpuid-dynamic-population.php`: Fixed an issue where dynamically populating Unique ID in Nested Forms caused memory exhaustion. --- gp-unique-id/gpuid-dynamic-population.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gp-unique-id/gpuid-dynamic-population.php b/gp-unique-id/gpuid-dynamic-population.php index d310b2804..f113af1de 100644 --- a/gp-unique-id/gpuid-dynamic-population.php +++ b/gp-unique-id/gpuid-dynamic-population.php @@ -11,6 +11,13 @@ */ add_filter( 'gform_field_value_uid', function( $value, $field ) { + static $processing = array(); + $key = $field->formId . '_' . $field->id; + if ( isset( $processing[ $key ] ) ) { + return $value; + } + $processing[ $key ] = true; + // Update what type of unique ID you would like to generate. Accepts 'alphanumeric', 'numeric', or 'sequential'. $type_of_id = 'alphanumeric'; @@ -28,5 +35,6 @@ $value = $gw_uid; } + unset( $processing[ $key ] ); return $value; }, 10, 2 );