DEV Community

Discussion on: Four Tips for a More Secure Website

Collapse
 
dvhh profile image
dvhh

because of performance issue for MySQL and prepared statement. it is possible that the prepared statement are ( unfortunately ) emulated ( see PDO::setAttribute and PDO::prepare ) .

I would recommend setting PDO::ATTR_EMULATE_PREPARES to false as much as possible.

Collapse
 
restoreddev profile image
Andrew Davis

Based on what I have read, emulated prepares are as safe as native prepares if you use them correctly. Though turning them off is a safer choice from a configuration perspective because it forces SQL to do the work. Setting up PDO could be a topic of its own post.

Collapse
 
dvhh profile image
dvhh

I am not aware of the internal implementation, but I still feel that native prepared statement is way safer than emulated one ( as the only obvious implementation would rely on some form of input escaping, which is not always working as intended )