Skip to content

Commit e5ae702

Browse files
authored
gpuid-dynamic-population.php: Fixed an issue where dynamically populating Unique ID in Nested Forms caused memory exhaustion.
1 parent 2999ced commit e5ae702

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gp-unique-id/gpuid-dynamic-population.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
*/
1212
add_filter( 'gform_field_value_uid', function( $value, $field ) {
1313

14+
static $processing = array();
15+
$key = $field->formId . '_' . $field->id;
16+
if ( isset( $processing[ $key ] ) ) {
17+
return $value;
18+
}
19+
$processing[ $key ] = true;
20+
1421
// Update what type of unique ID you would like to generate. Accepts 'alphanumeric', 'numeric', or 'sequential'.
1522
$type_of_id = 'alphanumeric';
1623

@@ -28,5 +35,6 @@
2835
$value = $gw_uid;
2936
}
3037

38+
unset( $processing[ $key ] );
3139
return $value;
3240
}, 10, 2 );

0 commit comments

Comments
 (0)