merged branch Tobion/patch-2 (PR #4878)

Commits
-------

d83d65a fix another '0' problem

Discussion
----------

fix another '0' problem
This commit is contained in:
Fabien Potencier 2012-07-12 17:57:58 +02:00
commit c4f3719a0d
1 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ class JsonResponse extends Response
*/
public function setCallback($callback = null)
{
if ($callback) {
if (null !== $callback) {
// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$parts = explode('.', $callback);
@ -95,7 +95,7 @@ class JsonResponse extends Response
*/
protected function update()
{
if ($this->callback) {
if (null !== $this->callback) {
// Not using application/javascript for compatibility reasons with older browsers.
$this->headers->set('Content-Type', 'text/javascript', true);