I have this code in cli.php file:
<?php
include __DIR__ . '/src/Framework/Database.php';
use FrameworkDatabase;
$db = new Database('mysql', [
'host' => 'localhost',
'port' => 3306,
'dbname' => 'phpiggy'
], 'root', '');
$search = "Hats' OR 1=1 -- ";
$query = "SELECT * FROM products WHERE name=?";
$stmt->$db->connection->prepare($query);
$stmt->execute([
$search
]);
var_dump($stmt->fetchAll(PDO::FETCH_OBJ));
After the command composer run-script phpiggy in the terminal, I should get the empty table. However, I get such warnings:
I can’t see where in this code lies the error that causes the above errors..
3