Yii Framework 2.0.0 GA
21–30 of 55 posts
Re: Yii Framework 2.0.0 GA
#22Re: Yii Framework 2.0.0 GA
#23Re: Yii Framework 2.0.0 GA
#24Earlier quoted context omitted.
> Entirely faults of PHP (lack of symbols, array(...) declarations, semicolon-itis) Sorry, but those are entirely trivial syntactic issues, and not very interesting at that either...
Symbols are not a syntactic issue. They are an optimization issue. They do not have the creation overhead of objects and they exist across the application in memory without the lookup overhead of a constant (PHP's closest cousin to a symbol). Lisp, Erlang, and Prolog (sure some other languages I've missed) have direct equivalents to Ruby symbols; they are sometimes referred to as symbols other times as atoms. Saying…
Re: Yii Framework 2.0.0 GA
#25Earlier quoted context omitted.
Symbols are not a syntactic issue. They are an optimization issue. They do not have the creation overhead of objects and they exist across the application in memory without the lookup overhead of a constant (PHP's closest cousin to a symbol). Lisp, Erlang, and Prolog (sure some other languages I've missed) have direct equivalents to Ruby symbols; they are sometimes referred to as symbols other times as atoms. Saying…
Ruby only needs symbols because it made the questionable choice of using mutable strings with by-object semantics. PHP does not have this problem. It will automatically intern literal strings, thus giving you the performance and memory usage benefits of symbols, but without the crutch of requiring a special syntax for them.
Granted, Ruby's use of symbols is not as pretty as other languages...
Re: Yii Framework 2.0.0 GA
#26You can jump start using the new app templates:
1) https://github.com/yiisoft/yii2-app-basic - simple app
2) https://github.com/yiisoft/yii2-app-advanced - if you need multiple interfaces (frontend/backend/api)
Re: Yii Framework 2.0.0 GA
#27+1 for opinionated security at the framework/platform level rather at the programmer level, such that security features can be evolved, refined, debugged over time and pushed back upstream, rather than reimplemented from scratch each new project.
Re: Yii Framework 2.0.0 GA
#28Earlier quoted context omitted.
Twig, at least, escapes by default. Laravel's Blade templates don't, unless that's changed recently. But the price you pay for that of course is no longer working directly in PHP but a templating language with its own syntax (for instance, array shorthand in Twig templates [] has worked since I don't know when but only recently has PHP gotten around to supporting it) which has to be parsed, and partially compiled int…
Yeah, frameworks that use raw PHP files as views at least have that as an excuse. But the cost of using a simple template engine with good caching support seems to be minimal compared to the benefit of XSS prevention. CodeIgniter, for example, can convert short tags to full PHP tags if short tags are turned off in php.ini. They might as well wrap htmlspecialchars() around every {$var} while they're at it. Non-PHP fra…
Re: Yii Framework 2.0.0 GA
#29> Yii 2.0 helps you to write more secure code. It has built-in support to prevent SQL injections, XSS attacks ... This is just a minor complaint, but it's so pervasive among web frameworks that I must complain yet again. According to the documentation for Yii 2.0, the recommended way to output a variable to a web page is: Not the PHP standard: Because if you do the latter, you will be vulnerable to XSS. But why does…
Twig, at least, escapes by default. Laravel's Blade templates don't, unless that's changed recently. But the price you pay for that of course is no longer working directly in PHP but a templating language with its own syntax (for instance, array shorthand in Twig templates [] has worked since I don't know when but only recently has PHP gotten around to supporting it) which has to be parsed, and partially compiled int…
Re: Yii Framework 2.0.0 GA
#30Earlier quoted context omitted.
It's a bit silly to worry about the overhead of strings over symbols when the PHP environment itself is not persistent across requests.
That seems to be missing the whole point of symbols/atoms. They are uniquely identified with an O(1) lookup time and persist in memory after the initial creation. Symbols persist across multiple requests; this is a big part of why they are so beneficial.
> Symbols persist across multiple requests; this is a big part of why they are so beneficial.
That is still not really useful, PHP throws the entire execution context away after the request has finished. There is no sharing nor anything to persist unless you're doing so with an external data-store.