With a PHP web application, I’m encountering a fatal error with PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, but only on very rare hosting plans. It’s saying this constant is not available. How do I detect that it’s not available and not use it?
I mean, I can use the if (!defined(…)) if/then check, but will this still get the fatal error on those systems where MYSQL_ATTR_MAX_BUFFER_SIZE is not compiled with PDO? Note that there’s a known bug regarding MYSQL_ATTR_MAX_BUFFER_SIZE and mysqlnd, where it’s not compiled in cases where mysqlnd is installed. The bug is marked as “won’t fix”.
You are not using
defined()properly, is my guess. You need to provide it a string.The above example doesn’t issue any notice/warning/error in my setup (PHP 5.3.20, in which
PDO::MYSQL_ATTR_MAX_BUFFER_SIZEis not defined), usingerror_reporting( E_ALL | E_STRICT ).