This is some weird bug, but here it is:
Before send to server some variable i'm assignig it programatically on Vue, its a binded var.
So on server side i do:
value = 'R$ 92,00'
and i send it to server (PHP - Laravel) that get it via a use Illuminate\Http\Request object
That is the issue:
On server side PHP is interpreting it with an extra char, this is an real example:
I send R$ 92,00 - Total 8 chars
this is the PHP var_dump output:
array(1) {
["value"]=> string(9) "R$ 92,00" // How 9?
}
If i try to console.log(value.length) the exactly same var before send to the server (on frontend) i get 8 as the length.
BUT, if i try to send again, another request (just after this one), this bug simple is gone and everything works normally.
My PHP code is just a var_dump so nothing special here:
public function store(Request $request, Client $client, Order $order)
{
if ($order->is_closed) {
abort(403);
}
var_dump($request->all()); // Here i can see what is happening
...
The frontend:
First i use a method to assign the value i want, the toBRL just format the value.
payRest () {
this.form.value = this.$helpers.toBRL(this.totalOwing)
},
After that i just make a store request to the server nothing special here:
async store () {
console.log(this.form.value.length)
try {
await this.$chimera._newPayment.fetch()
} catch (error) {}
},
This only happens when i assign values programatically on Vue, if i type the value everything works fine.
Chimera is just a lib to send axios request reactively, i can asure it's not the problem because i already had this issue using only axios.