vzsi
November 28, 2022, 9:58pm
1
Bricks Version : 1.5.7
Browser : Chrome 90
OS : macOS / Windows / Linux / etc.
URL : (a link to a page that illustrates the issue would be really helpful)
to comply accessibility <label tag needs a for=“”
I changed the code in searchfield.php to work proprely as follows (BOLD):
<label **for="search_field"** class="screen-reader-text"><span><?php esc_html_e( 'Search ...', 'bricks' ); ?></span></label>
<input type="search" placeholder="<?php esc_attr_e( $search_text ); ?>" value="<?php echo get_search_query(); ?>" name="s" **id="search_field"** />
2 Likes
timmse
November 30, 2022, 4:48pm
2
Hi Varga,
Thanks so much for your report, and welcome to the forum!
I’ve added your suggestion to the to-do list
Best regards,
timmse
timmse
December 22, 2022, 2:56pm
3
Hi Varga,
We’ve fixed this bug in Bricks 1.6.1, now available as a one-click update within your WordPress Dashboard.
Please let us know if you are still experiencing issues.
Best regards,
timmse
Sandro
December 23, 2022, 9:31am
4
I just updated to Bricks 1.6.1 and when in a page there is a “Search Field” I get this error:
This is the 404 page that contains the search field under the title.
I also get this error in Admin widget page, where there are the search field.
Any idea?
Thanks.
timmse
December 23, 2022, 11:41am
5
Hi Sandro,
I cannot reproduce the issue. On line 4 in searchform.php is the closing PHP tag, nothing more, nothing less. Can you please reupload the theme and see, if the issue gets fixed?
Which PHP Version are you using?
Sandro
December 23, 2022, 1:06pm
6
I am on PHP 8.0.8 and line 4 on my side is:
$for = "search-input-{$this->id}";
Commenting this line the error goes away.
I’ll try later with a clean installation of Bricks 1.6.1
Edit:
Same error on two different setup with clean installation of WP 6.1.1 + Bricks 1.6.1
WP_DEBUG ENABLED
MacOS Mamp with php 7.4.21 and 8.0.8
Docker with php 7.4.29
I also see the issue in the error log… here is my original post:
Bricks Version : 1.6.1
Browser : Safari
OS : macOS
URL : Error Log File
When looking at the error log, I keep seeing this line
PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/web/site/public_html/wp-content/themes/bricks/searchform.php:4
Here is the PHP Stacktrace
/var/web/site/public_html/wp-includes/general-template.php(308): require() /var/web/site/public_html/wp-content/themes/bricks/404.php(11): get_search_form(Array) /var/web/site/public_html/wp-includes/template-loader.php(106): include('/var/web/site/p...') /var/web/site/public_html/wp-blog-header.php(19): require_once('/var/web/site/p...') /var/web/site/public_html/index.php(17): require('/var/web/site/p...') {main} thrown in /var/web/site/public_html/wp-content/themes/bricks/searchform.php on line 4
The page seems to be working fine, but I discover this while looking for another issue.
hobe
December 26, 2022, 3:55pm
8
I had the same problem and I solved it by updating the permalinks in wordpress (it didn’t show the product page in woocommerce)
Hope that helps!
1 Like
Sandro
December 27, 2022, 3:51pm
9
Updating the permalinks does not help for me
hobe
December 27, 2022, 10:28pm
10
try this sandro:
$for = “search-input-{static::id}”;
info:
["Using $this when not in object context." Here's the fix. ]
Now the error was gone
AlMay
December 28, 2022, 9:02am
11
I also am getting the same fatal error after updating to 1.6.1. as those above -
PHP Fatal error: Uncaught Error: Using $this when not in object context in /public_html/wp-content/themes/bricks/searchform.php:4
AlMay
January 3, 2023, 10:26am
12
This is incorrect, unfortunately, the previous version of the file was just the closing php tag but now as Sandro says line 4 is
$for = “search-input-{$this->id}”;
And I’m getting fatal errors due to it per my post above.
Could you possibly look into it again with the latest version?
This post should not be marked as SOLVED, there is definitely an issue. I had another website throwing the same error as described above
PHP Fatal error: Uncaught Error: Using $this when not in object context in ********/wp-content/themes/bricks/searchform.php:4
I commented out line 4 and the error disappeared but this is just a bandaid. something else should be causing the issue.
thank you in advance for looking into it.
1 Like
timmse
January 4, 2023, 6:20pm
14
Hey guys,
I still cannot reproduce the issue, but added it to the bug tracker due to your reports.
Best regards,
timmse
1 Like
Hi all,
The dev team is aware of the issue.
The search form error is coming from Bricks 1.6.1, and will be fixed in the next update.
If you need a quick fix now you can change line 4 inside themes/bricks/searchform.php to:
$for = ‘search-input’;
Regards,
Jenn
2 Likes
i commented the line 4 with the error and i typed the code itchycode added but still not working
$for = ‘search-input’; and also try with double quotes and not working.
This is also not a solution. Pagination doesn’t work. This hid the error details lines. The error itself remains.
gokki
January 14, 2023, 12:06pm
20
Can confirm on v1.6.1 , Im getting this php error on line 4 too.