Discussion:
Class Static variables in double quoted string or heredoc
Leurent Francois
2008-04-25 15:50:40 UTC
Permalink
Is there any hope that
echo "Welcome {session::$user_info['user_name']}";

will work someday, if not, is there a simple reason i'm missing ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 15:56:24 UTC
Permalink
Post by Leurent Francois
Is there any hope that
echo "Welcome {session::$user_info['user_name']}";
will work someday, if not, is there a simple reason i'm missing ?
actually, if you see my post from the other day, this is something that
*was* supported in php-5.2.4. i dont know why its not working in 5.2.5; ive
also checked 5.2.6_rc3 and its not working there either. i have written
some phpt tests and run them on a 5.2.4 install and a 5.2.6_rc3 install; you
can find the details on a post to the php-qa list from a couple of days back
(that i posted after a lack of interest from the php-general list :O)

http://marc.info/?l=php-qa&m=120901795414161&w=2

-nathan
Jason Pruim
2008-04-25 16:02:58 UTC
Permalink
Post by Nathan Nobbe
Post by Leurent Francois
Is there any hope that
echo "Welcome {session::$user_info['user_name']}";
will work someday, if not, is there a simple reason i'm missing ?
actually, if you see my post from the other day, this is something that
*was* supported in php-5.2.4. i dont know why its not working in 5.2.5; ive
also checked 5.2.6_rc3 and its not working there either. i have written
some phpt tests and run them on a 5.2.4 install and a 5.2.6_rc3 install; you
can find the details on a post to the php-qa list from a couple of days back
(that i posted after a lack of interest from the php-general list :O)
http://marc.info/?l=php-qa&m=120901795414161&w=2
is there a reason why that would work better then: echo "Welcome
{$_SESSION['user_info']['user_name']}";?

Just curious :)

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
***@raoset.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Leurent Francois
2008-04-25 16:11:08 UTC
Permalink
I like the sess::reload() and sess::connect($user_login,$user_pswd);
idea...
Post by Jason Pruim
is there a reason why that would work better then: echo "Welcome
{$_SESSION['user_info']['user_name']}";?
Just curious :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 16:14:33 UTC
Permalink
Post by Jason Pruim
Post by Leurent Francois
Is there any hope that
Post by Leurent Francois
echo "Welcome {session::$user_info['user_name']}";
will work someday, if not, is there a simple reason i'm missing ?
actually, if you see my post from the other day, this is something that
*was* supported in php-5.2.4. i dont know why its not working in 5.2.5; ive
also checked 5.2.6_rc3 and its not working there either. i have written
some phpt tests and run them on a 5.2.4 install and a 5.2.6_rc3 install; you
can find the details on a post to the php-qa list from a couple of days back
(that i posted after a lack of interest from the php-general list :O)
http://marc.info/?l=php-qa&m=120901795414161&w=2
is there a reason why that would work better then: echo "Welcome
{$_SESSION['user_info']['user_name']}";?
Just curious :)
i think the question is more along the lines of why cant static references
be embedded within double quoted strings like class instances (and
indirectly the issue i mentioned earlier this week, which affords a
workaround), as in

<?php
class Session { function blah() {} }
$s = new Session();
echo "Hi {$s->blah()} \n";
?>

whereas this doesnt work
<?php
class Session { static function blah() {} }
echo "Hi {Session::blah()} \n";
?>

the funny thing is, in php-5.2.4, you can get away w/ this
<?php
class Session { static function blah() {} }
$s = 'Session';
echo "Hi {$s::blah()} \n";
?>

-nathan
Robert Cummings
2008-04-25 16:53:21 UTC
Permalink
Post by Nathan Nobbe
Post by Jason Pruim
Post by Leurent Francois
Is there any hope that
Post by Leurent Francois
echo "Welcome {session::$user_info['user_name']}";
will work someday, if not, is there a simple reason i'm missing ?
actually, if you see my post from the other day, this is something that
*was* supported in php-5.2.4. i dont know why its not working in 5.2.5; ive
also checked 5.2.6_rc3 and its not working there either. i have written
some phpt tests and run them on a 5.2.4 install and a 5.2.6_rc3 install; you
can find the details on a post to the php-qa list from a couple of days back
(that i posted after a lack of interest from the php-general list :O)
http://marc.info/?l=php-qa&m=120901795414161&w=2
is there a reason why that would work better then: echo "Welcome
{$_SESSION['user_info']['user_name']}";?
Just curious :)
i think the question is more along the lines of why cant static references
be embedded within double quoted strings like class instances (and
indirectly the issue i mentioned earlier this week, which affords a
workaround), as in
I think the real question is... why do you guys want to stick a whole
scripting engine into double quotes? There's this thing in PHP, it's
called the concatenation operator... read about it sometime.

*shakes his head* *points at the cavemen* *laughs* Hah hah!

:^

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 16:55:56 UTC
Permalink
Post by Nathan Nobbe
Post by Nathan Nobbe
On Fri, Apr 25, 2008 at 9:50 AM, Leurent Francois <
Post by Leurent Francois
Is there any hope that
Post by Leurent Francois
echo "Welcome {session::$user_info['user_name']}";
will work someday, if not, is there a simple reason i'm missing ?
actually, if you see my post from the other day, this is something
that
Post by Nathan Nobbe
Post by Leurent Francois
*was* supported in php-5.2.4. i dont know why its not working in
5.2.5;
Post by Nathan Nobbe
Post by Leurent Francois
ive
also checked 5.2.6_rc3 and its not working there either. i have
written
Post by Nathan Nobbe
Post by Leurent Francois
some phpt tests and run them on a 5.2.4 install and a 5.2.6_rc3
install;
Post by Nathan Nobbe
Post by Leurent Francois
you
can find the details on a post to the php-qa list from a couple of
days
Post by Nathan Nobbe
Post by Leurent Francois
back
(that i posted after a lack of interest from the php-general list :O)
http://marc.info/?l=php-qa&m=120901795414161&w=2
is there a reason why that would work better then: echo "Welcome
{$_SESSION['user_info']['user_name']}";?
Just curious :)
i think the question is more along the lines of why cant static
references
Post by Nathan Nobbe
be embedded within double quoted strings like class instances (and
indirectly the issue i mentioned earlier this week, which affords a
workaround), as in
I think the real question is... why do you guys want to stick a whole
scripting engine into double quotes? There's this thing in PHP, it's
called the concatenation operator... read about it sometime.
*shakes his head* *points at the cavemen* *laughs* Hah hah!
bah; concatenation operator - schmacatatenation operator! i dont really
care about that; but i would like to see support for $a::$someStatic come
back. thats what im whining about ;)

-nathan
Robert Cummings
2008-04-25 17:01:36 UTC
Permalink
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont really
care about that; but i would like to see support for $a::$someStatic come
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain about
new features not being simple enough for the supposed mentally incapable
masses. And yet there's support for this kind of double quoting stuff
that just makes me think poor form, bad style, and where's my t-shirt.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 17:11:23 UTC
Permalink
Post by Robert Cummings
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont really
care about that; but i would like to see support for $a::$someStatic come
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain about
new features not being simple enough for the supposed mentally incapable
masses. And yet there's support for this kind of double quoting stuff
that just makes me think poor form, bad style, and where's my t-shirt.
are you saying this feature is too esoteric for you ? :)

besides i didnt create the double quoted support and thats not even what im
arguing about anyway. the syntax ive mentioned was there in a pre-5.2.4
release (discovered it didnt actually make the cut for the 5.2.4) it save
you from having to write ugly little helper methods and thats a benefit i
wouldnt mind having.

php has a great dilema, it wants to cater to a wide range of users; from
newbs to experts. thats a massive undertaking and well if youre gonna do
it, you may as well go whole-hog IMHO.

-nathan
Robert Cummings
2008-04-25 17:19:58 UTC
Permalink
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont really
care about that; but i would like to see support for $a::$someStatic come
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain about
new features not being simple enough for the supposed mentally incapable
masses. And yet there's support for this kind of double quoting stuff
that just makes me think poor form, bad style, and where's my t-shirt.
are you saying this feature is too esoteric for you ? :)
No, it's too, hmmm... what's the word... REDUNDANT!

:)
Post by Nathan Nobbe
besides i didnt create the double quoted support and thats not even what im
arguing about anyway. the syntax ive mentioned was there in a pre-5.2.4
release (discovered it didnt actually make the cut for the 5.2.4) it save
you from having to write ugly little helper methods and thats a benefit i
wouldnt mind having.
There's a reason they call it "pre-release". It means it's not
"final" ;)
Post by Nathan Nobbe
php has a great dilema, it wants to cater to a wide range of users; from
newbs to experts. thats a massive undertaking and well if youre gonna do
it, you may as well go whole-hog IMHO.
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.

Just because a feature exists, doesn't mean you should use it!

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 17:29:05 UTC
Permalink
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont
really
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
care about that; but i would like to see support for $a::$someStatic
come
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain about
new features not being simple enough for the supposed mentally
incapable
Post by Nathan Nobbe
Post by Robert Cummings
masses. And yet there's support for this kind of double quoting stuff
that just makes me think poor form, bad style, and where's my t-shirt.
are you saying this feature is too esoteric for you ? :)
No, it's too, hmmm... what's the word... REDUNDANT!
:)
actually, its a little cleaner if you ask me. infact i think being able to
delimit strings in either single or double quotes was a precursor to this.
example: java; if i want to have double quotes in a string i *have* to
escape them w/in the string \". in php or javascript; i simply delimit the
string w/ single quotes. this feature is simply an evolution of that
concept, IMHO.
Post by Nathan Nobbe
besides i didnt create the double quoted support and thats not even what im
arguing about anyway. the syntax ive mentioned was there in a pre-5.2.4
release (discovered it didnt actually make the cut for the 5.2.4) it save
you from having to write ugly little helper methods and thats a benefit i
wouldnt mind having.
There's a reason they call it "pre-release". It means it's not
Post by Nathan Nobbe
"final" ;)
what the world needs is a term for the 'pre-release' being cooler than the
release ;)
Post by Nathan Nobbe
php has a great dilema, it wants to cater to a wide range of users; from
newbs to experts. thats a massive undertaking and well if youre gonna do
it, you may as well go whole-hog IMHO.
I don't see how the throwing everything and the kitchen sink into double
Post by Nathan Nobbe
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:),
i matter more !:D
Post by Nathan Nobbe
that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
if you dont know about the concatenation operator my thought is you wont be
going far w/ php or any other language for that matter :)

Just because a feature exists, doesn't mean you should use it!
here we are back at the classic syntactic sugar argument. at least weve
moved past abstract classes and interfaces !

good times :D

-nathan
Nick Stinemates
2008-04-25 17:37:11 UTC
Permalink
Post by Nathan Nobbe
here we are back at the classic syntactic sugar argument. at least weve
moved past abstract classes and interfaces !
for now........ :)
--
Nick Stinemates (***@stinemates.org)
http://nick.stinemates.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:26:20 UTC
Permalink
Post by Nick Stinemates
Post by Nathan Nobbe
here we are back at the classic syntactic sugar argument. at least weve
moved past abstract classes and interfaces !
for now........ :)
heh, ready whenever :)

-nathan
Robert Cummings
2008-04-25 18:21:27 UTC
Permalink
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont
really
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
care about that; but i would like to see support for $a::$someStatic
come
Post by Nathan Nobbe
Post by Robert Cummings
Post by Nathan Nobbe
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain about
new features not being simple enough for the supposed mentally
incapable
Post by Nathan Nobbe
Post by Robert Cummings
masses. And yet there's support for this kind of double quoting stuff
that just makes me think poor form, bad style, and where's my t-shirt.
are you saying this feature is too esoteric for you ? :)
No, it's too, hmmm... what's the word... REDUNDANT!
:)
actually, its a little cleaner if you ask me. infact i think being able to
delimit strings in either single or double quotes was a precursor to this.
example: java; if i want to have double quotes in a string i *have* to
escape them w/in the string \". in php or javascript; i simply delimit the
string w/ single quotes. this feature is simply an evolution of that
concept, IMHO.
Oh, I greatly see the utility in having support for both single and
double quoted strings. I just don't see the utility in supporting
"everything under the sun" expansion within double quotes.
Post by Nathan Nobbe
Post by Nathan Nobbe
besides i didnt create the double quoted support and thats not even what
im
Post by Nathan Nobbe
arguing about anyway. the syntax ive mentioned was there in a pre-5.2.4
release (discovered it didnt actually make the cut for the 5.2.4) it save
you from having to write ugly little helper methods and thats a benefit i
wouldnt mind having.
There's a reason they call it "pre-release". It means it's not
Post by Nathan Nobbe
"final" ;)
what the world needs is a term for the 'pre-release' being cooler than the
release ;)
Post by Nathan Nobbe
php has a great dilema, it wants to cater to a wide range of users; from
newbs to experts. thats a massive undertaking and well if youre gonna do
it, you may as well go whole-hog IMHO.
I don't see how the throwing everything and the kitchen sink into double
Post by Nathan Nobbe
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:),
i matter more !:D
Post by Nathan Nobbe
that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
if you dont know about the concatenation operator my thought is you wont be
going far w/ php or any other language for that matter :)
Just because a feature exists, doesn't mean you should use it!
here we are back at the classic syntactic sugar argument. at least weve
moved past abstract classes and interfaces !
good times :D
Funny you should mention that, I was going to add a reference to
interfaces and abstract classes when I mentioned that ;)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:28:53 UTC
Permalink
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Nathan Nobbe
On Fri, Apr 25, 2008 at 11:01 AM, Robert Cummings <
Post by Robert Cummings
Post by Nathan Nobbe
bah; concatenation operator - schmacatatenation operator! i dont
really
Post by Robert Cummings
Post by Nathan Nobbe
care about that; but i would like to see support for
$a::$someStatic
Post by Nathan Nobbe
Post by Nathan Nobbe
come
Post by Robert Cummings
Post by Nathan Nobbe
back. thats what im whining about ;)
That funny part, IMHO, is that on internals they often complain
about
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Robert Cummings
new features not being simple enough for the supposed mentally
incapable
Post by Robert Cummings
masses. And yet there's support for this kind of double quoting
stuff
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Robert Cummings
that just makes me think poor form, bad style, and where's my
t-shirt.
Post by Nathan Nobbe
Post by Nathan Nobbe
are you saying this feature is too esoteric for you ? :)
No, it's too, hmmm... what's the word... REDUNDANT!
:)
actually, its a little cleaner if you ask me. infact i think being able
to
Post by Nathan Nobbe
delimit strings in either single or double quotes was a precursor to
this.
Post by Nathan Nobbe
example: java; if i want to have double quotes in a string i *have* to
escape them w/in the string \". in php or javascript; i simply delimit
the
Post by Nathan Nobbe
string w/ single quotes. this feature is simply an evolution of that
concept, IMHO.
Oh, I greatly see the utility in having support for both single and
double quoted strings. I just don't see the utility in supporting
"everything under the sun" expansion within double quotes.
i hear you there; and i actually wasnt arguing for support of a wider range
of tokens to be supported within double quotes. all i was saying is that if
php had a feature that was in the 'pre-release' of 5.2.4 and will be in 5.3
anyway there is a workaround that gets you the ability with the current
double string variable / function call resolving support.
Post by Nathan Nobbe
Post by Nathan Nobbe
besides i didnt create the double quoted support and thats not even what im
Post by Nathan Nobbe
arguing about anyway. the syntax ive mentioned was there in a
pre-5.2.4
Post by Nathan Nobbe
Post by Nathan Nobbe
release (discovered it didnt actually make the cut for the 5.2.4) it
save
Post by Nathan Nobbe
Post by Nathan Nobbe
you from having to write ugly little helper methods and thats a benefit
i
Post by Nathan Nobbe
Post by Nathan Nobbe
wouldnt mind having.
There's a reason they call it "pre-release". It means it's not
Post by Nathan Nobbe
"final" ;)
what the world needs is a term for the 'pre-release' being cooler than
the
Post by Nathan Nobbe
release ;)
Post by Nathan Nobbe
php has a great dilema, it wants to cater to a wide range of users;
from
Post by Nathan Nobbe
Post by Nathan Nobbe
newbs to experts. thats a massive undertaking and well if youre gonna
do
Post by Nathan Nobbe
Post by Nathan Nobbe
it, you may as well go whole-hog IMHO.
I don't see how the throwing everything and the kitchen sink into double
Post by Nathan Nobbe
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:),
i matter more !:D
Post by Nathan Nobbe
that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
if you dont know about the concatenation operator my thought is you wont
be
Post by Nathan Nobbe
going far w/ php or any other language for that matter :)
Just because a feature exists, doesn't mean you should use it!
here we are back at the classic syntactic sugar argument. at least weve
moved past abstract classes and interfaces !
good times :D
Funny you should mention that, I was going to add a reference to
interfaces and abstract classes when I mentioned that ;)
and im sure that in the infamous words of tony marston, we would inevitably
'agree to disagree' :)

-nathan
Nick Stinemates
2008-04-25 17:35:54 UTC
Permalink
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
--
Nick Stinemates (***@stinemates.org)
http://nick.stinemates.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:25:31 UTC
Permalink
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more* structured
than the concatenation operator, when they work ;) but anyway, i got lured
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember feature which
i piggybacked into this conversation because of a lack of response on a
previous post from this week. and just to pour gas on the fire, if you guys
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!

-nathan
Eric Butera
2008-04-25 18:28:42 UTC
Permalink
Post by Nathan Nobbe
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
Like this?

return (!is_dir($indexPath))
? Zend_Search_Lucene::create($indexPath)
: Zend_Search_Lucene::open($indexPath);

;)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:29:21 UTC
Permalink
Post by Eric Butera
Post by Nathan Nobbe
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
Like this?
return (!is_dir($indexPath))
? Zend_Search_Lucene::create($indexPath)
: Zend_Search_Lucene::open($indexPath);
;)
u got it ;)

-nathan
Robert Cummings
2008-04-25 18:36:47 UTC
Permalink
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more* structured
than the concatenation operator, when they work ;) but anyway, i got lured
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember
Well, I certainly don't have a problem with $className::$staticMember.
But then, we ween't talking about that, were we! :)
Post by Nathan Nobbe
i piggybacked into this conversation because of a lack of response on a
previous post from this week. and just to pour gas on the fire, if you guys
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
I find it succinct for short evaluations... such as getting a $_GET
entry whether it exists or not.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:39:18 UTC
Permalink
Post by Nathan Nobbe
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into
double
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
quotes support caters to either of these groups. It strikes me, and
of
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
course that's who matters here >:), that it caters to the messy, "I
wish
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more* structured
than the concatenation operator, when they work ;) but anyway, i got
lured
Post by Nathan Nobbe
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember
Well, I certainly don't have a problem with $className::$staticMember.
But then, we ween't talking about that, were we! :)
i know; i tried to sneak it in to no avail; heh. anyway, no matter, i
finally got a reply on the qa list.
Post by Nathan Nobbe
Post by Nathan Nobbe
i piggybacked into this conversation because of a lack of response on a
previous post from this week. and just to pour gas on the fire, if you
guys
Post by Nathan Nobbe
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
I find it succinct for short evaluations... such as getting a $_GET
entry whether it exists or not.
ya; i know they have uses and (keep it on the dl) i have been known to use
them as well, rarely. but theyve grown on me a little since my initial
blanket hatred of them. more than anything i was just trying to stir things
up a bit :D

-nathan
Eric Butera
2008-04-25 18:44:16 UTC
Permalink
Post by Robert Cummings
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more* structured
than the concatenation operator, when they work ;) but anyway, i got lured
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember
Well, I certainly don't have a problem with $className::$staticMember.
But then, we ween't talking about that, were we! :)
Post by Nathan Nobbe
i piggybacked into this conversation because of a lack of response on a
previous post from this week. and just to pour gas on the fire, if you guys
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
I find it succinct for short evaluations... such as getting a $_GET
entry whether it exists or not.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You know... this topic hasn't been approached from the security angle
either. Best practices indicates all output should be properly
escaped based on the context it is going to be used in. So unless
that whole string is going to be escaped or a strong application level
filter using ext/filter is in place this should really be broken into
printf("Welcome %s",
htmlspecialchars(session::$user_info['user_name'], ENT_QUOTES));,
right? ;D
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings
2008-04-25 18:50:31 UTC
Permalink
Post by Eric Butera
Post by Robert Cummings
Post by Nathan Nobbe
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into double
quotes support caters to either of these groups. It strikes me, and of
course that's who matters here >:), that it caters to the messy, "I wish
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more* structured
than the concatenation operator, when they work ;) but anyway, i got lured
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember
Well, I certainly don't have a problem with $className::$staticMember.
But then, we ween't talking about that, were we! :)
Post by Nathan Nobbe
i piggybacked into this conversation because of a lack of response on a
previous post from this week. and just to pour gas on the fire, if you guys
want to know a syntactic sugar feature i avoid like the plague, its the
ternary operator!
I find it succinct for short evaluations... such as getting a $_GET
entry whether it exists or not.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You know... this topic hasn't been approached from the security angle
either. Best practices indicates all output should be properly
escaped based on the context it is going to be used in. So unless
that whole string is going to be escaped or a strong application level
filter using ext/filter is in place this should really be broken into
printf("Welcome %s",
htmlspecialchars(session::$user_info['user_name'], ENT_QUOTES));,
right? ;D
Why would anyone use htmlspecialchars() on a shell script?
Post by Eric Butera
:)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Eric Butera
2008-04-25 18:52:16 UTC
Permalink
Post by Robert Cummings
Why would anyone use htmlspecialchars() on a shell script?
:)
Who uses a session in a cli script?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 19:09:35 UTC
Permalink
Post by Eric Butera
Post by Robert Cummings
Why would anyone use htmlspecialchars() on a shell script?
:)
Who uses a session in a cli script?
i do; that way when the script terminates the session is wiped clean :D

-nathan
Eric Butera
2008-04-25 19:14:50 UTC
Permalink
Post by Nathan Nobbe
i do; that way when the script terminates the session is wiped clean :D
$GLOBALS would get you the same thing a lot easier. I've had to use
sessions in cli before just because I converted some old front-end
scripts that used to be spawned via a cron curl directly to CLI. So I
guess I can see it happening sometimes. *shrug*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 19:16:31 UTC
Permalink
Post by Eric Butera
Post by Nathan Nobbe
i do; that way when the script terminates the session is wiped clean :D
$GLOBALS would get you the same thing a lot easier. I've had to use
sessions in cli before just because I converted some old front-end
scripts that used to be spawned via a cron curl directly to CLI. So I
guess I can see it happening sometimes. *shrug*
it was a joke :P
Robert Cummings
2008-04-25 21:04:04 UTC
Permalink
Post by Eric Butera
Post by Robert Cummings
Why would anyone use htmlspecialchars() on a shell script?
:)
Who uses a session in a cli script?
Cron to destroy any expired sessions.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 18:51:18 UTC
Permalink
Post by Nathan Nobbe
Post by Robert Cummings
On Fri, Apr 25, 2008 at 11:35 AM, Nick Stinemates <
Post by Nick Stinemates
Post by Robert Cummings
I don't see how the throwing everything and the kitchen sink into
double
Post by Robert Cummings
Post by Nick Stinemates
Post by Robert Cummings
quotes support caters to either of these groups. It strikes me,
and of
Post by Robert Cummings
Post by Nick Stinemates
Post by Robert Cummings
course that's who matters here >:), that it caters to the messy,
"I wish
Post by Robert Cummings
Post by Nick Stinemates
Post by Robert Cummings
I REALLY knew what I was doing", slovenly crowd.
Just because a feature exists, doesn't mean you should use it!
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
Agree, and couldn't imagine working with someones code where they
liberally use these types of lazy things. I like structured, ordered
code, and, somehow, using something like this technique doesn't seem
structured or ordered.
to each his own; as i said personally, i consider those *more*
structured
Post by Robert Cummings
than the concatenation operator, when they work ;) but anyway, i got
lured
Post by Robert Cummings
into the argument for parsing variables and function calls in double
quotes. i have been arguing for the $className::$staticMember
Well, I certainly don't have a problem with $className::$staticMember.
But then, we ween't talking about that, were we! :)
i piggybacked into this conversation because of a lack of response on
a
Post by Robert Cummings
previous post from this week. and just to pour gas on the fire, if
you guys
Post by Robert Cummings
want to know a syntactic sugar feature i avoid like the plague, its
the
Post by Robert Cummings
ternary operator!
I find it succinct for short evaluations... such as getting a $_GET
entry whether it exists or not.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
You know... this topic hasn't been approached from the security angle
either. Best practices indicates all output should be properly
escaped based on the context it is going to be used in. So unless
that whole string is going to be escaped or a strong application level
filter using ext/filter is in place this should really be broken into
printf("Welcome %s",
htmlspecialchars(session::$user_info['user_name'], ENT_QUOTES));,
right? ;D
just to play devils advocate; it could still be crammed into double quotes,

<?php

class Session {
public $users = array();
}

class OutputEscaper {
function escapeStuff($stuff) {
return htmlspecialchars($stuff);
}
}

$s = new Session();
$oe = new OutputEscaper();

$s->users['user_name'] = 'some dude';

echo "Hi {$oe->escapeStuff($s->users['user_name'])}\n";
?>


-nathan
Eric Butera
2008-04-25 19:08:37 UTC
Permalink
Post by Nathan Nobbe
class OutputEscaper {
I dunno man. I have an escape() method on different classes such as
View (which can be told to use htmlspecialchars/entities), DB, etc.
This way you know you're doing $view->escape() or $db->escape()
instead of some generic thing. I think it helps me realize the
context a bit more than a stand-alone escaper that doesn't know the
details of what database I'm using or my target x/html output.

You could then argue that if you're trying to output user values in
HTML you should be working with something like htmlpurifier anyways.
But there are only so many hours in the day...

But back to the original point, you're cheating because you have
instances there, not static calls! :P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 19:12:01 UTC
Permalink
Post by Eric Butera
Post by Nathan Nobbe
class OutputEscaper {
I dunno man. I have an escape() method on different classes such as
View (which can be told to use htmlspecialchars/entities), DB, etc.
This way you know you're doing $view->escape() or $db->escape()
instead of some generic thing. I think it helps me realize the
context a bit more than a stand-alone escaper that doesn't know the
details of what database I'm using or my target x/html output.
meh; just make sure the instance holds what you want it to; it was just a
contrived example to illustrate the syntax supported in double quotes,
currently.

You could then argue that if you're trying to output user values in
Post by Eric Butera
HTML you should be working with something like htmlpurifier anyways.
But there are only so many hours in the day...
this techie burns the candle at both ends :)

But back to the original point, you're cheating because you have
Post by Eric Butera
instances there, not static calls! :P
heh, right; just holding my breath for php-5.3!

-nathan
Eric Butera
2008-04-25 19:16:19 UTC
Permalink
Post by Nathan Nobbe
meh; just make sure the instance holds what you want it to; it was just a
contrived example to illustrate the syntax supported in double quotes,
currently.
I know, I'm just goofing around on Friday. ;)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 19:17:05 UTC
Permalink
Post by Eric Butera
Post by Nathan Nobbe
meh; just make sure the instance holds what you want it to; it was just a
contrived example to illustrate the syntax supported in double quotes,
currently.
I know, I'm just goofing around on Friday. ;)
and i say again; good-times :D
Eric Butera
2008-04-25 17:02:57 UTC
Permalink
Post by Nathan Nobbe
i would like to see support for $a::$someStatic come
callback :P

http://us.php.net/manual/en/function.call-user-func-array.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nathan Nobbe
2008-04-25 17:11:55 UTC
Permalink
Post by Eric Butera
Post by Nathan Nobbe
i would like to see support for $a::$someStatic come
callback :P
http://us.php.net/manual/en/function.call-user-func-array.php
workaround-smerkaround :P

-nathan
Loading...