Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined property: SRM_Post_Type::$redirect_search_term #399

Closed
1 task done
chermant opened this issue Sep 23, 2024 · 4 comments · Fixed by #400
Closed
1 task done

Undefined property: SRM_Post_Type::$redirect_search_term #399

chermant opened this issue Sep 23, 2024 · 4 comments · Fixed by #400
Assignees
Labels
needs:feedback This requires feedback to determine next steps. type:bug Something isn’t working.
Milestone

Comments

@chermant
Copy link

Describe the bug

Hello,

There is an "Undefined property: SRM_Post_Type::$redirect_search_term" when I try to use the search engine on the redirect listing page.

The issue is from the inc/classes/class-srm-post-type.php at line 142 :
if ( $this->redirect_search_term ) {

The following code is solving this issue by adding a ! empty :
if ( ! empty( $this->redirect_search_term ) ) {

Is it possible to add it on the plugin please ?

Regards,
Clément.

Steps to Reproduce

  1. Go to Settings > Safe Redirect Manager
  2. Write a term of the search field
  3. Clic on "Search Redirect"
  4. See the Warning

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

WordPress : 6.6.2
PHP: 8.2
Framework: Themosis

Code of Conduct

  • I agree to follow this project's Code of Conduct
@chermant chermant added the type:bug Something isn’t working. label Sep 23, 2024
@Sidsector9 Sidsector9 self-assigned this Sep 23, 2024
@Sidsector9
Copy link
Member

Hi @chermant I am unable to reproduce the warning following your steps. Can you share the whole stack trace?
Can you also share the version of the plugin?

@Sidsector9 Sidsector9 added the needs:feedback This requires feedback to determine next steps. label Sep 23, 2024
@chermant
Copy link
Author

chermant commented Sep 23, 2024

Hello @Sidsector9 ,

Thank you for the response !

We are using the plugin in the latest version 2.2.0.

Here is the stack trace:

content/plugins/safe-redirect-manager/inc/classes/class-srm-post-type.php:142
    SRM_Post_Type->filter_search_clauses()
    wp-includes/class-wp-hook.php:324
    apply_filters_ref_array('posts_clauses')
    wp-includes/class-wp-query.php:2955
    WP_Query->get_posts()
    wp-includes/class-wp-query.php:3852
    WP_Query->query()
    wp-includes/class-wp-theme-json-resolver.php:517
    WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles()
    wp-includes/class-wp-theme-json-resolver.php:557
    WP_Theme_JSON_Resolver::get_user_data()
    wp-includes/class-wp-theme-json-resolver.php:673
    WP_Theme_JSON_Resolver::get_merged_data()
    wp-includes/global-styles-and-settings.php:80
    wp_get_global_settings()
    wp-includes/fonts/class-wp-font-face-resolver.php:29
    WP_Font_Face_Resolver::get_fonts_from_theme_json()
    wp-includes/fonts.php:46
    wp_print_font_faces()
    wp-includes/class-wp-hook.php:324
    do_action('admin_print_styles')
    wp-admin/admin-header.php:132

@Sidsector9
Copy link
Member

Thanks for sharing! Nothing unusual in the trace. What is surprising is that $redirect_search_term exists as a class property, I don't understand why it would be undefined at all 🤔

@10up/open-source-practice can you try reproducing this issue?

@peterwilsoncc
Copy link
Contributor

@Sidsector9 I was able to reproduce and have created PR #400 to resolve.

@jeffpaul jeffpaul added this to the 2.3.0 milestone Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:feedback This requires feedback to determine next steps. type:bug Something isn’t working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants