: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
private function search_in_standalone_forms(): array {
foreach ( Locator::STANDALONE_LOCATION_TYPES as $location_type ) {
$location_types[] = '"' . $location_type . '_enable":"1"';
$regexp = implode( '|', $location_types );
$post_statuses = wpforms_wpdb_prepare_in( $this->locator->get_post_statuses() );
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$standalone_forms = $wpdb->get_results(
"SELECT ID, post_content, post_status
WHERE post_status IN ( $post_statuses ) AND
post_type = 'wpforms' AND
post_content REGEXP '$regexp';"
// phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
foreach ( $standalone_forms as $standalone_form ) {
$form_data = json_decode( $standalone_form->post_content, true );
$locations[] = $this->locator->build_standalone_location(
(int) $standalone_form->ID,
$standalone_form->post_status
* Get form location metas.
* @param array $locations Locations.
private function get_form_location_metas( $locations ) {
foreach ( $locations as $location ) {
if ( empty( $location['form_id'] ) ) {
$metas[ $location['form_id'] ][] = $location;
* Log message to WPForms logger and standard debug.log file.
* @param string $message The error message that should be logged.
* @noinspection ForgottenDebugOutputInspection
* @noinspection PhpUndefinedConstantInspection
private function log( $message ) {
if ( defined( 'WPFORMS_DEBUG' ) && WPFORMS_DEBUG ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
wpforms_log( 'Forms Locator', $message, [ 'type' => 'log' ] );