Skip to content

POST Body Empty in iOS Simulator — $_POST / $request->all() Returns Empty Array #87

@WojciechRhdt

Description

@WojciechRhdt

What were you trying to do?

When submitting an HTML form via POST with Content-Type: application/x-www-form-urlencoded inside the NativePHP iOS WebView (WKWebView), PHP's $_POST superglobal is always empty. Laravel's $request->all() returns [] even though the request method and content type header are correct.

Environment

NativePHP Mobile 3.2.2
Laravel 12.x
PHP 8.3.30
Platform iOS Simulator (macOS)

What happened?

$request->all() returns an empty array despite the correct method and content type:

{
  "all": [],
  "method": "POST",
  "content_type": "application/x-www-form-urlencoded"
}

How to reproduce the bug

  1. Create a standard HTML form with method="POST":
<form method="POST" action="/submit">
    <input type="hidden" name="_token" value="...">
    <input type="text" name="name" value="John">
    <input type="password" name="password" value="secret123">
    <button type="submit">Submit</button>
</form>
  1. In the receiving controller, inspect the request:
public function submit(Request $request)
{
    Log::debug('request', [
        'all'          => $request->all(),
        'method'       => $request->method(),
        'content_type' => $request->header('Content-Type'),
    ]);
}
  1. Fill out the form in the iOS Simulator and submit it.

Expected Behavior

$request->all() returns the submitted field values:

{
  "name": "John",
  "password": "secret123"
}

Debug Output

INFO NativePHP Mobile.

+--------------------+--------+
| Package Version | 3.2.2 |
| PHP Version (Host) | 8.3.30 |
| OS | Darwin |
| OS Version | 25.2.0 |
| Embedded PHP | 8.3 |
+--------------------+--------+

INFO Installed Plugins.

None

INFO Development Tools.

+----------------+------------------+
| Xcode | Xcode 26.4 |
| Android Studio | Not found |
| Gradle | Not found |
| Java | Not found |
| CocoaPods | CocoaPods 1.16.2 |
+----------------+------------------+

Which operating systems have you seen this occur on?

macOS

Which platforms were you trying to build for?

iOS (Simulator)

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions