: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace NinjaForms\Includes\Admin;
* Deregister completed or incorrectly structured updates
* Function to deregister already completed updates from the list of required updates.
* @param $updates (Array) Our array of required updates.
* @return $updates (Array) Our array of required updates.
public function removeCompletedUpdates($updates)
$processed = $this->getRequiredUpdates();
// ensure that $processed value is expected type 'array'
if(!\is_array($processed)){
// For each update in our list...
foreach ($updates as $slug => $update) {
// If we have already processed it...
if (isset($processed[$slug])) {
// Remove it from the list.
isset($updates['CacheCollateFields'])
&& isset($updates['CacheFieldReconcilliation'])
&& !isset($processed['CacheFieldReconcilliation'])
unset($updates['CacheFieldReconcilliation']);
// Append the current update to the array.
$processed['CacheFieldReconcilliation'] = $now;
$this->updateRequiredUpdates($processed);
* Function to deregister updates that have required updates that either
* don't exist, or are malformed
* @param $updates (Array) Our array of required updates.
* @return $updates (Array) Our array of required updates.
public function removeBadUpdates($updates)
$processed = get_option('ninja_forms_required_updates', array());
// While we have not finished removing bad updates...
while (count($sorted) < count($updates)) {
// For each update we wish to run...
foreach ($updates as $slug => $update) {
// Migrate the slug to a property.
// If we've not already added this to the sorted list...
if (!in_array($update, $sorted)) {
// If it has requirements...
if (!empty($update['requires'])) {
// For each requirement...
foreach ($update['requires'] as $requirement) {
// If the requirement doesn't exist...
if (!isset($updates[$requirement])) {
// unset the update b/c we are missing requirements
$nf_bad_update_transient = get_transient('nf_bad_update_requirement');
if (!$nf_bad_update_transient) {
// send telemetry so we can keep up with these
Ninja_Forms()->dispatcher()->send(
'missing_requirement' => $requirement
set_transient('nf_bad_update_requirement', $requirement, 30 * 3600);
// If the requirement has already been added to the stack...
if (in_array($requirement, $queue)) {
} // OR If the requirement has already been processed...
elseif (isset($processed[$requirement])) {
// If all requirement are met...
if ($enqueued == count($update['requires'])) {
array_push($sorted, $update);
// Record that we enqueued it.
array_push($queue, $slug);
} // Otherwise... (It has no requirements.)
array_push($sorted, $update);
// Record that we enqueued it.
array_push($queue, $slug);
* Retrieve required updates array from stored location
* Note that until retrieved value is validated as an array, we do not
* declare return type to prevent error
protected function getRequiredUpdates( )
$return = get_option('ninja_forms_required_updates', array());
* Update value of 'required updates' in storage location
protected function updateRequiredUpdates(array $updates): void
update_option('ninja_forms_required_updates', $updates);
* Return formatted date string
protected function getDate( ): string
date_default_timezone_set('UTC');
$return = date("Y-m-d H:i:s");