/** * Prepare the parameters for a PDO connection. * Protects MySQL from charset injection risk. * @see http://www.propelorm.org/ticket/1360 * * @param array $params the connection parameters from the configuration * * @return array the modified parameters */ protected function prepareParams($params) { if (isset($params['settings']['charset'])) { if (false === strpos($params['dsn'], ';charset=')) { $params['dsn'] .= ';charset=' . $params['settings']['charset']; unset($params['settings']['charset']); } } return parent::prepareParams($params); }
/** * We need to replace oracle: to oci: in connection's dsn. * * @param array $params * @return array */ protected function prepareParams($params) { if (isset($params['dsn'])) { $params['dsn'] = str_replace('oracle:', 'oci:', $params['dsn']); } return parent::prepareParams($params); }
/** * Prepare the parameters for a PDO connection. * Protects MySQL from charset injection risk. * @see http://www.propelorm.org/ticket/1360 * * @param array the connection parameters from the configuration * * @return array the modified parameters */ protected function prepareParams($params) { if (isset($params['settings']['charset']['value'])) { if (version_compare(PHP_VERSION, '5.3.6', '<')) { throw new PropelException(<<<EXCEPTION Connection option "charset" cannot be used for MySQL connections in PHP versions older than 5.3.6. Please refer to http://www.propelorm.org/ticket/1360 for instructions and details about the implications of using a SET NAMES statement in the "queries" setting. EXCEPTION ); } else { if (strpos($params['dsn'], ';charset=') === false) { $params['dsn'] .= ';charset=' . $params['settings']['charset']['value']; unset($params['settings']['charset']); } } } return parent::prepareParams($params); }