質問

Is this expression is safe or does this approach has vulnerabilities?

$pdo = new PDO('mysql:host=localhost;dbname=test', 'user', 'password');
$pdo->exec('SET time_zone = "' . date_default_timezone_get() . '"');

正しい解決策はありません

他のヒント

I would check first if date_default_timezone_get() returns a valid value, to avoid a query like: SET time_zone = "".

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top