php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81307 session_start block echo from method POST using Fetch js
Submitted: 2021-07-29 13:00 UTC Modified: 2021-07-29 14:02 UTC
From: nwnisworking at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Session related
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2021-07-29 13:00 UTC] nwnisworking at gmail dot com
Description:
------------
PHP version : 8.0.6

It seems that when you fetch the file using POST, if the file uses session_start, it will not render or run the .php file. The page will only load when you submit the form without using js fetch.


Test script:
---------------
[index.php]
<script>
fetch('login.php', {method : "POST", body : JSON.stringify({test : "test"})});
</script>

[login.php]
<?php
session_start();
session_write_close(); # without this is also cause the same issue
echo 'testing';
?>

Expected result:
----------------
The rendered result from fetch.

Actual result:
--------------
Nothing was shown from inspect_element > network.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-29 14:02 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-07-29 14:02 UTC] cmb@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC