[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg

WordPress Trac noreply at wordpress.org
Mon Nov 7 05:20:40 UTC 2016


#32315: $wpdb->insert fails without error msg
------------------------------------------+------------------------------
 Reporter:  dlt101                        |       Owner:
     Type:  defect (bug)                  |      Status:  reopened
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Database                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by pento):

 Replying to [comment:24 datainterlock]:
 > Ok, then what's the solution then when the data you're inserting is of
 unknown length yet you don't want to make every field a blob? So far, I've
 been criticized and accused of crying in this thread when I'm trying to
 point out that in the REAL WORLD of data, you don't always have the luxury
 of knowing the exact length of what you're trying to insert and giving the
 end user truncated data is more valuable than no data at all.

 Most fields that you'd store data of unknown length in are `LONGTEXT`
 fields, which allow 4GB of data. Unless you expect to go over that, you
 don't really need to check the length.

 For shorter fields, it should be part of your standard data sanitisation
 process to check the length, the same as you'd check for unsafe HTML, or
 SQL injection attacks (note that WPDB's CRUD methods will take care of SQL
 injection prevention for you).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32315#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list