PHP try-catch não está funcionando
try
{
$matrix = Query::take("SELECT moo"); //this makes 0 sense
while($row = mysqli_fetch_array($matrix, MYSQL_BOTH)) //and thus this line should be an error
{
}
return 'something';
}
catch(Exception $e)
{
return 'nothing';
}
No entanto, em vez de apenas pegar parte e retornarnothing
mostra um avisoWarning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given
na linha que começa comwhile
. Eu nunca cheguei a usar exceções no php, mas usei muito em c # e parece que no PHP eles estão trabalhando de forma diferente ou, como sempre, estou perdendo algo óbvio.