[ create a new paste ] login | about

Link: http://codepad.org/6hvr4CLP    [ raw code | output | fork ]

PHP, pasted on Oct 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
try{
//The exception is thrown.
throw new Exception('Parâmetros de consulta inválidos');

// and in the catch block it's caught successfully:
}catch(Exception $e){
    echo $e->getMessage(); //This prints the message correctly.

    $output = json_encode(array('msg'=>$e->getMessage()));
    echo $output; //But this fails...displays {"msg":null}

}


?>


Output:
1
Parâmetros de consulta inválidos{"msg":"Par\u00e2metros de consulta inv\u00e1lidos"}


Create a new paste based on this one


Comments: