Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14680
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Consistency with object to boolean conversions |
| Date | 2014-12-03 16:19 +0100 |
| Organization | solani.org |
| Message-ID | <m5n9l9$djm$1@solani.org> (permalink) |
| References | <m5n8a7$gra$1@dont-email.me> |
Gregor Kofler wrote:
> The following example should suffice to describe my problem:
>
> 50 if(!$file) {
> 51 }
> 52 else {
> 53 echo '$file is an object.';
> 54 var_dump(!$file);
> 55 }
>
> results in
>
> "$file is an object.
>
> Catchable Fatal Error: Object of class
> Symfony\Component\HttpFoundation\File\UploadedFile could not be
> converted to boolean in
> /var/www/strbase_client/src/Strbase/ClientBundle/Controller/BatchController.php
> line 54"
>
> Why does the object to boolean conversion in the if condition in line 50
> *not* cause an error?
What gets printed when you change line 51 to:
var_dump($file);}
I guess that answers your question.
--
Christoph M. Becker
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 15:56 +0100
Re: Consistency with object to boolean conversions "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-03 16:19 +0100
Re: Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 16:39 +0100
Re: Consistency with object to boolean conversions Matthew Carter <m@ahungry.com> - 2014-12-03 11:42 -0500
Re: Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 18:06 +0100
Re: Consistency with object to boolean conversions Matthew Carter <m@ahungry.com> - 2014-12-03 13:13 -0500
Re: Consistency with object to boolean conversions Denis McMahon <denismfmcmahon@gmail.com> - 2014-12-03 16:46 +0000
Re: Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 18:09 +0100
Re: Consistency with object to boolean conversions "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-03 18:22 +0100
Re: Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 19:12 +0100
Re: Consistency with object to boolean conversions "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-03 19:30 +0100
Re: Consistency with object to boolean conversions Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 20:58 +0100
csiph-web