ORM’s fuelphp update resulted in “rather than” sporadic “

I am using PHP 5.4 And I got very strange behavior using the fuelphp ORM save and update function

I'm trying to save serialized or JSON data to fields in the database, so it's like {"name": "Michael"} When I use model - > Save () directly after model:: Forge (), it seems to work normally 100% of the time. The string you see is the string stored in the MySQL database

However, if I immediately change something like model - > property = 'new property' (not JSON or serialized data properties) and then execute another model – > Save (), it will "convert" all my data to & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; QUOT;

It seems that when I debug the problem and execute it line by line, it will not reproduce the problem! It will pass through the entire script and still have the correct "not & quot;

This question drives me crazy I'll assume it's configured or there will be more complaints, but I can't find the right switch I have set up two PHP_ flag magic_ quotes_ GPC shutdown and PHP_ flag magic_ quotes_ Runtime is in my Close in htaccess (although this should not be done in PHP 5.4) and verify that both are false

I have no idea here Any investigation will be very helpful

Solution

Your ORM may use some escape function to save your JSON string This is a security function to prevent SQL injection attacks If you need to store JSON, please use NoSQL solutions such as mongodb or CouchDB Otherwise, you need to clean up your JSON string after your MySQL comes out and before decoding

http://dev.mysql.com/doc/refman/5.0/en/string-literals.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>