question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If a variable passed to view is 0 (int), the "echo" will be empty

See original GitHub issue

In my controller, I pass variables to my view like this:

return view.render('search', {
  total: 0
})

From my view, if I do {{ total }} it will be empty, but it works if I pass the variable like a string:

return view.render('search', {
  total: '0'
})

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
RomainLanzcommented, Dec 9, 2018

It’s already fixed in the new version of Edge that should be out soon. Stay tunned!

1reaction
adamlccommented, Feb 15, 2019

@RomainLanz any updates on this? I noticed it doesn’t seem to be working in 1.1.4 either

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - if a variable in my while loop is empty, echo a 0 instead ...
In recent PHP versions you can use $row['Score'] ?: 0 etc.
Read more >
empty() function in PHP to check variable for null, zero value etc
This function empty() will return True or False ( Boolean return ) based on status of the variable. if(empty($my_var)){echo " Variable is empty...
Read more >
empty - Manual - PHP
A variable is considered empty if it does not exist or if its value equals false . empty() does not ... echo '$var...
Read more >
How can I test if a variable is empty or contains only spaces?
First, note that the -z test is explicitly for: the length of string is zero. That is, a string containing only spaces should...
Read more >
How to determine if a bash variable is empty? - Server Fault
A variable in bash (and any POSIX-compatible shell) can be in one of three ... is passed # 4. an empty array is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found