PDO not throwing exception with unbound parameters (and no variables in query)

So I have no idea what’s going on here

$link = new PDO('pgsql:dbname=' . $name . ';host=' . $host, $user, $password);
$link->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

try {
    $stmt = $link->prepare("SELECT s.*, d.invalid_column FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1));
}
catch (PDOException $e) {
    print $e->getMessage();
}

When I run this little code example, I expect an exception to be thrown (as d.invalid_column is not a real column and I’m passing in parameters that cannot be bound), but the only thing that happens is that execute returns false and nothing else. Additionally $stmt->errorInfo() is blank and the code is 00000 which makes it hard to add a proper exception throw beyond something super generic with nothing else for the logs to assist me in tracking errors down when some end user reports an error.

If I add a single ‘?’ somewhere to the query, the proper execution is thrown (that d.invalid_column is not a valid column), even if I add more parameters that don’t bind to anything.

So ways to get this query to properly error:
1) Get rid all parameters
2) Add a ‘?’ to the query

Is this just a bug in PDO or what?

edit:
Setups that will throw an exception (invalid column):

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1));

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1,2,3));

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute();

read more

PDO not throwing exception with unbound parameters (and no variables in query)

So I have no idea what’s going on here

$link = new PDO('pgsql:dbname=' . $name . ';host=' . $host, $user, $password);
$link->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

try {
    $stmt = $link->prepare("SELECT s.*, d.invalid_column FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1));
}
catch (PDOException $e) {
    print $e->getMessage();
}

When I run this little code example, I expect an exception to be thrown (as d.invalid_column is not a real column and I’m passing in parameters that cannot be bound), but the only thing that happens is that execute returns false and nothing else. Additionally $stmt->errorInfo() is blank and the code is 00000 which makes it hard to add a proper exception throw beyond something super generic with nothing else for the logs to assist me in tracking errors down when some end user reports an error.

If I add a single ‘?’ somewhere to the query, the proper execution is thrown (that d.invalid_column is not a valid column), even if I add more parameters that don’t bind to anything.

So ways to get this query to properly error:
1) Get rid all parameters
2) Add a ‘?’ to the query

Is this just a bug in PDO or what?

edit:
Setups that will throw an exception (invalid column):

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1));

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute(array(1,2,3));

    $stmt = $link->prepare("SELECT s.*, d.invalid_column, ? FROM students s ORDER BY s.student_id");
    $stmt->execute();

read more

Scott McNealy’s Wayin gets $15.4M from investors including SAP’s Plattner

Wayin, the latest venture from ex-Sun Microsystems CEO Scott McNealy, got a considerable boost Friday with a fresh $15.4 million infusion from big-name investors including SAP co-founder Hasso Plattner.

Also participating in the round, which was led by an undisclosed new investor, were David Duffield, founder of PeopleSoft and co-founder and chairman of Workday, along with Wayin chairman and CEO McNealy himself.

Launched by McNealy in 2011 as a social gaming service, Wayin has since transformed to focus on real-time digital marketing. Today, Wayin integrates with publicly shared Twitter, Facebook and Instagram content to help marketers and media companies find the most compelling social content and trends to tap in their engagement efforts.

read more