Existing PHP catches and bugs

I will keep updating this post as part of note whenever I find another catch and bug in PHP. I hope it can help beginner PHP developers (like me) out there to escape hours of confusion and stress .. 😅

PUT multipart/data bug

As explained by this open bug (since 2011), when you submit a multipart/data PUT request (usually for uploading file), you will not receive the data as usual in PHP. The best workaround so far, is to send the multipart/data request as POST and to add additional field _method with PUT value. You will also experience this bug in all well-known PHP frameworks.

Dots and spaces in request variable names are replaced by underscore

Yes, you heard it right. By default, PHP will convert all dots and spaces in request variable names to underscore. So, if you send variable named product.id in your request, you will only find product_id in your PHP code. Thrilling isn’t it? 😂

Leave a Reply

Your email address will not be published. Required fields are marked *