1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-16 21:08:34 +01:00
php-debugbar/demo/pdo.php
Barry vd. Heuvel 11896db266
Escape doctrine entries (#657)
* Escape doctrine entries

* Add PDO browsertest
2024-06-10 11:29:12 +02:00

29 lines
805 B
PHP

<?php
include 'bootstrap.php';
use DebugBar\DataCollector\PDO\TraceablePDO;
use DebugBar\DataCollector\PDO\PDOCollector;
$pdo = new TraceablePDO(new PDO('sqlite::memory:'));
$debugbar->addCollector(new PDOCollector($pdo));
$debugbar['pdo']->setDurationBackground(true);
$pdo->exec('create table users (name varchar)');
$stmt = $pdo->prepare('insert into users (name) values (?)');
$stmt->execute(array('foo'));
$stmt->execute(array('bar'));
$users = $pdo->query('select * from users')->fetchAll();
$stmt = $pdo->prepare('select * from users where name=?');
$stmt->execute(array('foo'));
$foo = $stmt->fetch();
$stmt = $pdo->prepare('select * from users where name=?');
$stmt->execute(array('<script>alert();</script>'));
$foo = $stmt->fetch();
$pdo->exec('delete from users');
render_demo_page();