PHP 5.4 Released
mikejuk writes "PHP 5.4 has been released, along with a new version of Zend Framework. It has a number of optimizations that make it faster and smaller (early estimates say 10-20% faster), a built-in webserver for testing purposes, and features that had been destined for PHP 6.0. The big addition from the now-crashed PHP 6.0 project is Traits, which are sort of a cross between a class and an interface, bringing some of the advantages of multiple inheritance to PHP. The full changelog and download page are both available."
Please enlighten me on the "advantages" of multiple inheritance.
Everything I've learned has taught me that MI is a BAD thing (worse than GOTO), so I'm honestly curious what these supposed "advantages" are.
Let's call it what it is, Anti-Social Media.
Telling us readers how it (the new PHP) measures up to the competition would have been better and more informative.
So, let me bite: How does this new release measure up to the competition?
What synchronicity! Just the other day I was thinking about the beautiful and elegant poetry that is PHP's syntax and standard library, and I was saying to myself, "You know... if there's one thing PHP needs, it's multiple inheritance."
Breakfast served all day!
PHP has always been a security nightmare. Can anyone speak about security issues, enhancements, etc, that us sysadmins should know about?
well, it's PHP. And the competition is not PHP. So the competition wins.
The people who scream the loudest about how multiple inheritance or gotos are bad are the ones who also scream the loudest about "best practices", but in reality write some of the shittiest code there is.
Just look at Java and C#. The worst Java and C# developers are those who go on and on about design patterns. Then instead of writing software that solves real problems, they spend months and years putting together frameworks and obtuse architectures that are damn near impossible to use in practice.
Then there are the Ruby users. Basically everything they advocate is wrong. Maybe it lets you crank out yet another blog engine quickly, but what they propose falls apart completely for any moderately complex application. All it takes is debugging one problem caused by monkeypatching, and you'll immediately see how stupid their ideas are.
JavaScript "programmers" are the worst. Their language is so fucked up, but most of them are so ignorant that they can't see this for themselves. I mean, they didn't even manage to get equality comparisons implemented in a sensible manner! Yes, very core functionality like that is broken.
PHP has traditionally been just slightly better than JavaScript, in terms of developer stupidity, but at least they're making a small degree of progress in the right direction. We can't say the same for Ruby, though. In fact, we rarely hear about Ruby these days. The hype surrounding it sure has died down lately. This isn't completely unexpected. Consistent failures, like most sizable Ruby projects tend to be, can quickly kill even the loudest hype.
If you want opinion, go read an op ed in your local news, or if you really need technology opinion pieces, go read a PC World or what have you. PHP 5.4 being released is news people will care about, hence it being here.
what the hell are we supposed to do with 5.4 when so many apps/scripts out there haven't even been fixed to handle the kinks in 5.3? and many hosters haven't even put 5.3 on their servers yet.
This is so damn insightful!
If you mean 'use some simple method' to defeat SQL injection. (And let's face it it isn't difficult but some people find it hard.) then that's a fair point. If you mean 'stored procedures' then that's a sledgehammer to crack a nut which introduces yet another layer in an already complex stack. If people are not using OO to do their database access then they get what they deserve!
well, it's PHP. And the competition is not PHP. So the competition wins.
No, the competition is, for example, .NET, which is unable to win.
It'd be really nice if PHP would add some nice template features that Smarty / Twig have. (elseforeach, simple echo htmlentities construct ?)
The developers of PHP are so focused on becoming a real language that they've forgotten what PHP is all about: templating! There's no real focus on adding template features (ok... I don't have to type array now...).
"... from the now-crashed PHP 6.0 project...". When did PHP 6 crash? I was looking forward to some of those features.
If you want opinion, go read an op ed in your local news, or if you really need technology opinion pieces, go read a PC World or what have you. PHP 5.4 being released is news people will care about, hence it being here.
I care, that is why I'm here.
Finally the LDAP extension has paging support. About damn time.
A language named after a main TLD sounds, indeed, a bit iffy. Maybe the nostalgia of the late .COM?
Slashdot, fix the reply notifications... You won't get away with it...
Score, booyah, bitch slap, slam dunk.
I object to power without constructive purpose. --Spock
Goody! Just another 5 years 'till it hits the production servers now.
Bitten Apples are still better than dirty Windows...
You base your criticism of a platform (not a language) on its name? Seems pretty arbitrary.
On top of that, the old platform was just called COM (no dot).
For what it's worth, I've used pretty much all the well-known languages out there (OO languages, functional ones, dynamic ones) and I have to say that the .NET framework and C# are pretty damn good. In particular, the C# language designers are really good at incorporating the good ideas from other languages but keeping the syntax from spiraling out of control (a la C++).
Not that this opinion will garner much praise on slashdot.
CAPTCHA: informed
If you want to get your code compatible, a start is to scan it automatically : https://github.com/wimg/PHPCompatibility - just released for 5.4 as well :-)
Not that this opinion will garner much praise on slashdot
I don't agree, /. changed since a couple of years. Bashing Microsoft or its products generally flags a Troll or a -1 anyway. The top post related to .NET here is being "Troll". Well, /. didn't change actually. More people read it, from more communities, including MS and the like. /. being (I think) fair in terms of moderators, the "new" people from those communities flag the bashers all the time. Even the Microsoft logo changed recently, the new one being more neutral.
Slashdot, fix the reply notifications... You won't get away with it...
I've been waiting for traits in php (and thus php 5.4 when they finally decided to put traits into it) for some time now.
Think of traits not as really an extension to the object oriented features (alternative to multiple inheritance..) but as a kind of language assisted cut and paste with conflict resolution.
Because that's what it is. Traits are "flattened" at run time. Their methods become methods of the class where the trait is used, and work exactly like they were defined there to begin with. If there is a collision in the naming, you can specifically resolve that with language syntax.
-- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.
Can't they just release a new version of PHP that doesn't break backward compatibility. Microsoft was able to do this with classic ASP and for the most part .NET for many years now. Sun and Oracle figured out how to do it with Java. Why can't Zend do it?
I'm tired of having features disappear. Yeah, magic quotes and safe mode were stupid. Maybe if they actually designed the damn language rather than throw in crap all the time this wouldn't happen.
This is the single biggest issue I have with PHP.
MidnightBSD: The BSD for Everyone
But that's just me.
GRRR. "extends" was for inheritance, "implements" was for interfaces, so why wasn't "uses" chosen for traits, instead of "use"?
Loban Amaan Rahman ==> Anagram of ==> Aha! An Abnormal Man!
Dynamic/static and strict/weak are orthogonal in general. A dynamically typed language could just as easily verify that all necessary methods defined by an interface are implemented by an implementation -- it's just that the check would happen at run-time rather than compile time.
HAND.
Why wouldn't it be?
I can say that it's not just you. LOTS of people are wrong about this.
There are plenty of reasons, but one of the best ones is that "web development" isn't necessarily separate from other development. If you're using the same data structures and operations across multiple targets (web, desktop, mobile), OO is definitely a good idea.
--I'm so big, my sig has its own sig.
-- See?
How is the server side code of a web application different than any other OO codebase? The worst PHP codebases are the procedural variety mixing PHP, SQL, HTML, CSS and javascript in randomly hacked together scripts. I've been unfortunate enough to inherit several of these over the years... THE HORROR!
Because functional programming with continuations just may be a better approach to taming stateless HTTP?
Ezekiel 23:20
If you like continuations you can certainly have them in an OOP language, or even a hybrid OOP/functional one if that's your thing.
First, always use parameterized queries (prepared statements) using PDO or MySQLi.
I agree with you that queries in MySQLi should almost always be parameterized. But in moving from "almost always" to "always", I have found a few stragglers where I still think I have to use $db->escape($some_value). For example, how do I use MySQLi with parameterized queries that have a variable number of parameters, such as username IN ('filbert', 'bluebear', 'lucky') where the number of names on the right side of operator IN may vary? I'd have to build three things in parallel: the statement with a variable number of ? placeholders, the string of argument types, and the array of values. I'd have to construct the array of values differently for the different versions of PHP, whose semantics of call_user_func_array differs from PHP version to PHP version. I'd also have to be extra careful to make sure that the order of ? placeholders in the statement stays in sync with the order of items in the array of values, as letting them fall out of order is just as dangerous as letting an SQL injection slip through. Or should I just bite the bullet and port the entire application from MySQLi to PDO, which supports named placeholders?
How do you use the same data structures across all targets when you can't even use the same language across all targets? The client side of web must use JavaScript, and the client side of mobile must use C# unless you have a separate team for the Windows Phone 7, Android, and iOS versions.
The problem here might not be the open tag
I've seen the misbehavior even in projects whose coding style guide forbids a final closing tag. In such files, the open tag is the only possible culprit. The issue is that a lot of programming language interprets cannot be configured to treat 0xEF 0xBB 0xBF, the UTF-8 byte order mark that several text editors automatically insert at the start of a file, as something to skip. Nor can several popular text editors, especially text editors designed to run on the Windows operating system, be configured to never insert the byte order mark. Or should developers always follow strict internationalization guidelines and include human-readable text only in external PO files, never in a PHP file?
To use a standard PHP IDE to write your code
What is "the standard PHP IDE" in the way that Visual Studio is "the standard C# IDE" and NetBeans or Eclipse is "the standard Java IDE"?
I don't care, but I've got nowhere else to go.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
.. [JS] didn't even manage to get equality comparisons implemented in a sensible manner!
Yeah, coz PHP really *shines* for equality comparisons.
switch("dog") { ... I expected string comparison, but whatever.");
case 0 : echo("Won't see this, nosir."); break;
case "dog" : echo("This will be shown, promise."); break;
}
if("123" == " 123") echo("Hmmm
if("123" == "123 ") echo("You'll at least be consistent about trimming though, right?");
JavaScript gets loosely-typed comparison operations pretty spot on IMO - i.e., logical and intuitive results, including for "truthiness" evaluation. Of course, like any language it has its share of quirks - e.g.:
if( parseInt("0123") != 123) alert("Eeek - are you *really* defaulting to Octal radix for zero-padded nums, parseInt?!");
if(typeof null == "object") alert("Meh, Netscape!");
if( myDate.month == 11 ) alert("December, ORLY?");
First, using the same data structures is fairly easy across multiple languages
But if I make changes to a data structure or object in one language, how do I arrange for the changes to propagate automatically to the other languages?
if you use web services to be consumed across your platforms, you don't need to duplicate business logic in more than one language (you can at least minimize it)
I'm familiar with JSON web services. But the business logic has to be duplicated on the client if the application has any hope of being able to run offline or use peripherals such as the accelerometer, camera, and microphone. Otherwise I could just make a web application.
Third, you're mentioning three mobile platforms that pretty much require an OO approach
I wasn't saying OO was a bad idea, just that an application designed to work offline must implement business logic on the client side. So must an application designed to be more responsive than the fairly large ping of a satellite or 3G connection.