Ending ',' in array list definition

30 views
Skip to first unread message

Anderson A. Meggiolaro

unread,
Oct 25, 2012, 2:59:55 PM10/25/12
to smarty-d...@googlegroups.com

Hey guys, 

I've just noticed that having a left ',' at the end of an array list definition raises an uncaught exception in smarty. As php itself accepts that, I wonder if you guys intend to fix that or not.

{$a = [1,2,]}

Best regards,

--

-------------------------------------------------------------
Anderson André Meggiolaro Priedols
Pesquisador Desenvolvedor - UnB/MCid
-------------------------------------------------------------

Monster Green

unread,
Oct 26, 2012, 7:05:44 AM10/26/12
to smarty-d...@googlegroups.com
Hello,

The fact that PHP accepts something doesn't mean that it is right to use
it that way. IMHO it is not a bug

Best
Maurycy

On 25/10/2012 19:59, Anderson A. Meggiolaro wrote:
>
> Hey guys,
>
> I've just noticed that having a left ',' at the end of an array list
> definition raises an uncaught exception in smarty. As php itself
> accepts that, I wonder if you guys intend to fix that or not.
>
> {$a = [1,2,]}
>
> Best regards,
>
> --
>
> -------------------------------------------------------------
> Anderson Andr� Meggiolaro Priedols
> Pesquisador Desenvolvedor - UnB/MCid
> -------------------------------------------------------------
> --
> You received this message because you are subscribed to the Google
> Groups "Smarty Developers" group.
> To post to this group, send email to smarty-d...@googlegroups.com.
> To unsubscribe from this group, send email to
> smarty-develop...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/smarty-developers?hl=en.

Anderson A. Meggiolaro

unread,
Oct 29, 2012, 9:10:21 AM10/29/12
to smarty-d...@googlegroups.com
Hello, 

Yes, it's not a bug, it just took me a while to figure out what the problem was in my code once I'm used to left the last ','. But it would be nice to have this kind of compatibility with php itself.

Anderson

On Fri, Oct 26, 2012 at 9:05 AM, Monster Green <secret....@gmail.com> wrote:
Hello,

The fact that PHP accepts something doesn't mean that it is right to use it that way. IMHO it is not a bug

Best
Maurycy


On 25/10/2012 19:59, Anderson A. Meggiolaro wrote:

Hey guys,

I've just noticed that having a left ',' at the end of an array list definition raises an uncaught exception in smarty. As php itself accepts that, I wonder if you guys intend to fix that or not.

{$a = [1,2,]}

Best regards,

--

-------------------------------------------------------------
Anderson André Meggiolaro Priedols

Pesquisador Desenvolvedor - UnB/MCid
-------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups "Smarty Developers" group.
To post to this group, send email to smarty-developers@googlegroups.com.
To unsubscribe from this group, send email to smarty-developers+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/smarty-developers?hl=en.
--
You received this message because you are subscribed to the Google Groups "Smarty Developers" group.
To post to this group, send email to smarty-developers@googlegroups.com.
To unsubscribe from this group, send email to smarty-developers+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/smarty-developers?hl=en.




--

-------------------------------------------------------------
Anderson André Meggiolaro Priedols

ShOtY

unread,
Oct 30, 2012, 12:52:00 AM10/30/12
to smarty-d...@googlegroups.com
IE javascript doesn't support that last comma, so templates can have javascript inside and it's ok to behave the same. I've seen programmers that never tests on IE and they receive reports later that the page doesn't work. This way maybe some of them get used not to use that last comma as smarty will always throw an error.
Reply all
Reply to author
Forward
0 new messages