#41171 closed defect (bug) (invalid)
Incorrect (query?) fetching of Pages
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Rewrite Rules | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
So, this occurs on 4.8 and 4.7 (even down to 3.x) alike, so it's most likely a compatibility bug between the versions of software in use and WordPress. Versions are listed below.
The effects are pretty bad as I can no longer open Posts ('Invalid post type.') and no longer use Pages ('No pages found') however there are three items correctly listed in the 'All' count on Pages, so the count queries work correctly.
I tried figuring out what happens, but I have not managed to nail it down to the exact error. I also tried Googling this issue and the 'fixes' did not go beyond: nail this down to a plugin. I can reproduce this error with each clean install (no plugins, nothing beyond the default theme) over and over again, so that's not going to fix it.
To fetch the content of 'Pages' the following query is executed (courtesy of Query Monitor):
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name = 'edit-php' AND wp_posts.post_type = 'page' ORDER BY wp_posts.post_title ASC
Which is odd since no pages have the name edit-php.
This explains why it shows 'No Pages found', the query returns none.
The page however itself is called edit.php. I'm supposing something is going wrong with the query input here. It seems mixed up.
I'm at the same time provided with a (because of debug on):
Notice: Undefined offset: 1 in /home/mydomain/public_html/wp-includes/vars.php on line 31
This file relies on $_SERVER['PHP_SELF']
to obtain the page information. If I slip in a phpinfo()
in the line above the 'if' to assert wheter it's filled with the correct information I get: $_SERVER['PHP_SELF'] /edit.php
. This seems correct, so it's kind of odd that offset 1 is undefined
on $self_matches
.
When debugging $self_matches
on line 31, I get: array(0) { }
.
Server environment as reported by Query Monitor:
PHP Property Value version 7.0.19 sapi fpm-fcgi user wantsone max_execution_time 30 memory_limit 1G upload_max_filesize 64M post_max_size 64M
Database Property Value extension mysqli server version 5.5.5 client version 50012 (5.0.12) user mysite_wp1 host localhost database mysite_wp1 key_buffer_size 134217728 ~128 MB max_allowed_packet 4194304 ~4 MB max_connections 151 query_cache_limit 1048576 ~1 MB query_cache_size 1048576 ~1 MB query_cache_type OFF (Help)
Database is in fact: MariaDB 10.1.24
WordPress Property Value version 4.8 WP_DEBUG true WP_DEBUG_DISPLAY true WP_DEBUG_LOG false SCRIPT_DEBUG false WP_CACHE false CONCATENATE_SCRIPTS undefined COMPRESS_SCRIPTS undefined COMPRESS_CSS undefined WP_LOCAL_DEV undefined
Server Property Value software Apache version 2
Apache is in fact: Server version: Apache/2.4.26 (Unix)
64bit MPM event
Attachments (3)
Change History (13)
This ticket was mentioned in Slack in #core by dixita. View the logs.
6 years ago
#3
@
6 years ago
Those patches successfully get rid of the 'notice', however the original problem (incorrect query) still persists.
#4
@
6 years ago
Just ran into this problem after upgrading homebrew packages. Adding ProxyFCGIBackendType GENERIC
to httpd.conf resolves the issue, cf. https://stackoverflow.com/q/44657362
#5
@
6 years ago
- Keywords close added
@donutz you are my hero! That fixed the issue for me.
I guess there isn't too much WordPress itself can do about it, since this is a bug in Apache.
Thanks for the WP folks fixing the notice :).
#6
@
6 years ago
- Keywords close removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
check for isset $self_matches[1] for pagenow