Welcome Guest, Not a member yet? Register   Sign In
Problem with POST data types
#5

(This post was last modified: 04-08-2024, 09:08 AM by motoroller.)

(04-08-2024, 01:47 AM)kenjis Wrote: It was converted to int implicitly by PHP.
But in 4.5.0 "declare(strict_types=1);" has been added to most of the framework codebase.
See https://www.php.net/manual/en/language.t...ons.strict
Because if devs expect int values, string values should not pass the validation.

So now it is not converted implicitly, and causes TypeError.

> Sorry this is not a bug, but an intended behavior of PHP.

This sentence was not precise. PHP's default behavior is to convert implicitly,
but now we use strict mode for strict type coding.

what is better solution?

Send data like JSON? but in this way i can use $this->request->getPost('id')
and need rewrite all logick in project.

Or i need conver data on the server after receiving?
Any way i can`t use $this->request->getPost('id')

is any function if i get jSON, put data in POST automaticly?


For example i have simple form send by POST
in server i get $this->request->getPost('id'), $this->request->getPost('type') ect
all type of course string by default, before validate i need set correct types for each field?
Reply


Messages In This Thread
Problem with POST data types - by motoroller - 04-07-2024, 05:39 PM
RE: Problem with POST data types - by kenjis - 04-07-2024, 07:23 PM
RE: Problem with POST data types - by motoroller - 04-08-2024, 12:20 AM
RE: Problem with POST data types - by kenjis - 04-08-2024, 01:47 AM
RE: Problem with POST data types - by motoroller - 04-08-2024, 08:55 AM
RE: Problem with POST data types - by kenjis - 04-08-2024, 01:55 PM
RE: Problem with POST data types - by motoroller - 04-10-2024, 01:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB