[wp-trac] [WordPress Trac] #50641: Everything is being called twice
WordPress Trac
noreply at wordpress.org
Mon Jul 13 17:40:10 UTC 2020
#50641: Everything is being called twice
----------------------------+--------------------------
Reporter: luciano_mb | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Bootstrap/Load | Version: 5.4.2
Severity: normal | Resolution: invalid
Keywords: | Focuses: performance
----------------------------+--------------------------
Changes (by SergeyBiryukov):
* severity: critical => normal
* milestone: Awaiting Review =>
Old description:
> I noticed the problem when I was setting up an Ajax action which creates
> a file with a random name. It always created 2 files with random names.
>
> This is a clean install.
>
> I went ahead and started debugging the core files and realized that
> everything is called twice. For example, try echoing "ok" in the wp()
> function in wp-includes/functions.php - it will output "okok" in the
> front-end.
>
> Is this by design or is there something wrong with the current version of
> WP?
> Is there something I should do to avoid this?
>
> Thank you.
>
> Steps to reproduce:
>
> 1 - Add this function to the theme functions.php:
> function test() {
> fopen("/var/www/html/yourpath/test." . random_int(0, 100000), "w");
> die();
> }
> add_action('wp_ajax_test', 'test');
>
> 2 - Access the URL: /wp-admin/admin-ajax.php?action=test
>
> 3 - Check your directory to see 2 different files were created
New description:
I noticed the problem when I was setting up an Ajax action which creates a
file with a random name. It always created 2 files with random names.
This is a clean install.
I went ahead and started debugging the core files and realized that
everything is called twice. For example, try echoing "ok" in the wp()
function in wp-includes/functions.php - it will output "okok" in the
front-end.
Is this by design or is there something wrong with the current version of
WP?
Is there something I should do to avoid this?
Thank you.
Steps to reproduce:
1 - Add this function to the theme functions.php:
{{{
function test() {
fopen("/var/www/html/yourpath/test." . random_int(0, 100000), "w");
die();
}
add_action('wp_ajax_test', 'test');
}}}
2 - Access the URL: /wp-admin/admin-ajax.php?action=test
3 - Check your directory to see 2 different files were created
--
Comment:
Hi there, welcome to WordPress Trac! Thanks for the ticket.
For reference, I could not reproduce the issue with the steps provided,
only one file was created on my install.
Similar issues are generally caused by browser prefetching, see #12603,
#14382, #19018, #20192, #21658, #28797, #32290, #45108. Some browsers
automatically load any `<link>` elements with `rel="next"` or
`rel="prefetch"`.
So it doesn't look like there's a bug here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50641#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list