Slashdot Mirror


PHP 5.5.0 Released

New submitter irventu writes "The long-awaited PHP 5.5.0 has finally been released, bringing many new features and integrating Zend's recently open-sourced OPcache. With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands, Google recently announcing support for PHP in its App Engine and the current PHP renaissance is well underway. This is great news for the web's most popular scripting language." The full list of new features is available at the Change Log, and the source code is at the download page.

43 of 219 comments (clear)

  1. PHP 6.0 without the stupid? by Anonymous Coward · · Score: 5, Insightful

    I'm still waiting for a PHP 6.0 that's an actual rewrite without all the stupid. With every new version, I just see more features get tacked on ("Objects").

    It's wonderfully backward compatible because nothing really gets removed in newer versoins, but it would be nice if the language could be made more pleasant to use.

    1. Re:PHP 6.0 without the stupid? by Anonymous Coward · · Score: 5, Informative

      The thing that bothers me most is the inconsistency in function names or argument order. When I'm using PHP, I have to constantly keep looking the functions up to make sure its doing what I expect.

    2. Re:PHP 6.0 without the stupid? by Anonymous Coward · · Score: 2, Funny

      That would be Perl.

    3. Re:PHP 6.0 without the stupid? by squiggleslash · · Score: 5, Funny

      what_have youGot AGAINST $_THEWAY PHP works($dummy, WORKS_TODAY)? I think it's==great, wait, sorry I mean "I think it's===great." - I accidentally passed in null and that last condition gave me a bunch of false positives.

      I'm hoping PHP6 will finally give programmers the ==== and ===== operators we've been waiting for.

      --
      You are not alone. This is not normal. None of this is normal.
    4. Re:PHP 6.0 without the stupid? by Megane · · Score: 3
      A PHP that isn't a fractal of bad design? Unpossible.

      I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there. You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes. You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    5. Re:PHP 6.0 without the stupid? by gmack · · Score: 5, Insightful

      Because then some people would have to stop updating? The place I work has code dating back 10 or 11 years and the programmers already have to go through the code each update to see what got dropped and even then there will be demands for the upgrade to be rolled back or "delayed" (moved to a point in the future that never happens because they never have time for it).

      It's not just in house stuff that doesn't update either, Check out large Open source projects and see how many of them generate warnings related to deprecated functions.

      If you want a language that has no cruft there are languages you can switch to but not many people use them for the reasons stated a above.

    6. Re:PHP 6.0 without the stupid? by gbjbaanb · · Score: 4, Funny

      so do I.. but then, I'm old and I have to do that for everything. Maybe its not the language after all.. just saying :-)

    7. Re:PHP 6.0 without the stupid? by i_ate_god · · Score: 4, Informative

      == and === are common in dynamically typed languages

      assert 1 == true //works
      assert 0 == false //works
      assert 1 === true // fails
      assert 0 === false // fails

      --
      I'm god, but it's a bit of a drag really...
    8. Re:PHP 6.0 without the stupid? by kbolino · · Score: 4, Insightful

      Indeed, but the problem is type coercion and not dynamic typing. You can have a dynamically typed language that does not coerce unlike types to make life "easier".

    9. Re:PHP 6.0 without the stupid? by Samantha+Wright · · Score: 4, Informative
      --
      Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
    10. Re: PHP 6.0 without the stupid? by thetoadwarrior · · Score: 4, Insightful

      This is one of the biggest problems. It's a horrible language to look at. The carelessness carries through the community too. You simply can't trust third party to be anything but amateur. But who can blame PHP devs when the core language is cack and the documentation is laughable.

    11. Re: PHP 6.0 without the stupid? by gorzek · · Score: 2

      What I've found to be truly bizarre is that a lot of the official documentation makes no sense, in and of itself. It's vague and difficult to interpret. You normally have to scroll down to the comments to see how people actually use it, and it's only at that point that the function in question begins to make any sense. The documentation itself is just too barebones to be adequate.

      Python's practice of including simple examples with the documentation of virtually every command and function and feature is incredibly handy.

    12. Re: PHP 6.0 without the stupid? by Bert64 · · Score: 4, Insightful

      Part of the problem with PHP is that it's designed to be simple to pick up... Many people start by just adding one or two simple PHP tags to an existing HTML file and go from there.

      No need to learn a development environment, no need to create archives or packages, quite literally anyone can create their first "dynamic" webpage by adding one line of php to an existing html file, many people do something really simple like just show the current time etc.

      This accessibility has a price, because php is accessible to people with little or no experience of writing code, then lots of such people use it and this often results in very poor code. It's perfectly possible to write very clean code with PHP, you just have to look for it amongst all the thousands of novice programmers turning out junk.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    13. Re: PHP 6.0 without the stupid? by Dracos · · Score: 2, Insightful

      Hey, don't blame all of us for Wordpress.

    14. Re:PHP 6.0 without the stupid? by Anonymous Coward · · Score: 2, Interesting

      I'm still waiting for a PHP 6.0 that's an actual rewrite without all the stupid.

      And I'm still waiting for all the PHP haters to fork it and create a new version and "do it right." The language is open source, you know.

      Evidently none of the self-proclaimed "experts" in programming language design is willing to fix PHP.

    15. Re:PHP 6.0 without the stupid? by squiggleslash · · Score: 4, Insightful

      While that's true, the complaint isn't that PHP has a dynamic typing system and has some operators that reflect that, it's that the coercion and comparison rules are... not exactly easy to predict. Not to mention the fact === works the way you'd expect == to work, with == performing non-intuitive coercion to try to find a way to make different things the same.

      assert(""==false);
      assert(0==false);
      assert("0"==false);
      assert(null==false);

      All of these will succeed.

      * Intuitively to a non-PHP programmer, only the second one should.
      * A PHP programmer with experience will, on the other hand, note that given "echo 1==2" products no output, only the first should be guaranteed to succeed with the second one maybe kinda succeeding.

      The others? Dubious at best. The third should always fail, because "0" != "false" and "0" != "" (but PHP is doing the wrong coercion so it instead converts the string to a boolean rather than vice-versa), the fourth treats null in a way that almost makes SQL look logical.

      Ironically, your observation makes my joke more accurate than originally intended. Given the behavior of == is not what's needed in a dynamically typed, softly typed, language, and === provides only one of the legitimate comparison operators necessary for such a language, we do, actually, need an ==== operator in PHP. Scary, huh?

      --
      You are not alone. This is not normal. None of this is normal.
    16. Re:PHP 6.0 without the stupid? by countach74 · · Score: 2

      Yeah no kidding. Another big gripe of mine is how most of the things that you'd like to try/catch doesn't throw an exception, but some sort of "notice" or "warning", which you cannot respond to. I've managed to work around this by implementing custom error handlers, but that brings its own problems when other peoples' code expects the default behavior. What's worse is the stuff that throws warnings/notices are things that are very basic: accessing an array element that doesn't exist, opening a file without proper permissions (or doesn't exist), etc. Argh, the whole language is garbage and the community that generally uses it only adds to the problem. But alas, I am forced to work in it.

      Note: To those who haven't yet ventured out beyond PHP for the web, you will likely be pleasantly surprised how much more productive you can be in a sane language.

    17. Re: PHP 6.0 without the stupid? by garyebickford · · Score: 4, Informative

      Ha. As a programmer in at least two handfuls of languages over 40 years from IBM 1130 ASM, FORTRAN, ALGOL 68, Pascal, Basic (ick), APL, etc., and long time programmer in PHP, I am presently in the process of hacking up someone else's Perl.

      Nobody who writes in Perl can have anything to say about the structure, style or consistency of PHP. PHP may have grown like topsy and it could certainly use some revision of function argument order, but it at least uses a syntax that is remotely similar to other common imperative languages - java, c, etc. From my first look at Perl in 1995 I always thought Perl looked like sneezing, and now I'm working with it, my first impression was correct. (Although in fairness I use PCRE in PHP quite a lot!)

      This is my most recent 'fave' quote from perlsyn - on 'when', which is part of Perl's attempt to rethink (or something) the switch/case pattern:

      Exactly what the EXPR argument to when does is hard to describe precisely, but in general, it tries to guess what you want done. Sometimes it is interpreted as $_ ~~ EXPR, and sometimes it does not. It also behaves differently when lexically enclosed by a given block than it does when dynamically enclosed by a foreach loop. The rules are far too difficult to understand to be described here. See Experimental Details on given and when later on.

      Pathologically Eclectic Rubbish Lister indeed!

      Since I'm on a role here, I will complain about one thing in Python, though I've only programmed a bit in Python. Python's much vaunted 'indent' based nesting is a mistake, because it only uses one invisible marker (which may be instantiated by several symbols - spaces and tabs, at least) to do this. All other common languages I can think of use different markers for begin and end, which acts as a kind of 'double entry bookkeeping' for the parser. Without a closing marker, Python's parser has no way to catch errors in leading spaces.

      A similar type of error results from C's syntax, which was unfortunately adopted in PHP - in allowing action inside a conditional "if ($foo = 1 + $bar)", the poor parser has no way to know if one really means 'compare' or 'assign'. This is the cause of innumerable bugs in both languages. This could be fixed by requiring assignments inside a conditional to be surrounded by block markers: "if ({$foo = 1 + $bar})".

      But I like all 'scripted' languages better for my purposes (entirely applications, no device drivers or kernel work) than C and other 2nd generation languages. I've had exactly one segfault working with PHP, in nearly 20 years.

      --
      It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    18. Re:PHP 6.0 without the stupid? by squiggleslash · · Score: 2

      Did some experimenting after that and I just found a great one:

      assert("false"==true);

      Yes, it passes.

      --
      You are not alone. This is not normal. None of this is normal.
    19. Re:PHP 6.0 without the stupid? by pmontra · · Score: 2

      I read the Laravel page and it's great to see how closely they managed to mimic Ruby and Rails (I used "and" on purpose). However it also exposes the limits of the language.

      This PHP

      $tasks = User::find(1)->tasks;
      $author = Task::find(5)->user()->username;
      $task = new Task([ title: 'Go to store.' ]);
      User::find(1)->tasks()->insert($task);

      would be this Ruby

      tasks = User.find(1).tasks
      author = Task.find(5).user.username
      task = new Task({title: 'Go to store.'}) # but the {} are idiomatically removed in this case because there are no ambiguities
      User.find(1).tasks.insert(task)

      Count the keyboard hits and shift saved. Think about the signal to noise ratio of the two pieces of code.

      Ruby has its share of oddities but PHP is an easy target for critics. Using $ for variables was a terrible decision, worse than Ruby's @ and @@ for instance and class variables. Using -> to access methods and attributes was a bad trade with the ability to use . for string concatenation. Mandatory () for function call and around if (conditions) are useless as well as the semicolon at the end of lines. Compilers and interpreters can be made smart enough to understand when a statement is complete without forcing the programmer to do part of their job. And think of the mandatory $this->. Argh!

      Yeah, let's hope for a wised up PHP x.0. A first step has been allowing [ ] in place of array( )

    20. Re: PHP 6.0 without the stupid? by datavirtue · · Score: 2

      Powershell was created for people who have absolutely no idea what they are doing. Sysadmins. As a developer it looks like fucking Greek to me.

      --
      I object to power without constructive purpose. --Spock
  2. Bugs & Maintainers by TheNinjaroach · · Score: 4, Informative

    I participated in beta release testing for 5.5 and I'm frustrated that it still has old bugs that cause segfaults that continue to go ignored by the maintainers. I even supplied the patch and submitted a Github pull request, but the maintainers continue to ignore it.

    It's no fun having to keep our own custom patchsets for PHP just to keep it running properly.

    --
    I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
    1. Re:Bugs & Maintainers by chris200x9 · · Score: 2

      Fork it?

    2. Re:Bugs & Maintainers by Grashnak · · Score: 5, Funny

      Fork it?

      Shame on you for harming future generations of girl coders! I must tweet your picture and publicly shame you!!!!

      --
      Life needs more saving throws.
  3. Citation needed by benjymouse · · Score: 4, Insightful

    With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands

    Citation needed. Why does the summary contain this blurb which is not even relevant to the story. Me suspects that the submitter could be an advocate who just ceased on an opportunity to tell slashdot about his favorite PHP framework.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
    1. Re:Citation needed by dkleinsc · · Score: 2

      just ceased on an opportunity

      I don't think that means what you think it means.

      --
      I am officially gone from /. Long live http://www.soylentnews.com/
    2. Re:Citation needed by dkleinsc · · Score: 2

      No, he wanted to say "seized". But I blame Noah Webster: Before he came along, people spelled words any way they dam wel pleezed.

      --
      I am officially gone from /. Long live http://www.soylentnews.com/
  4. Not even trying to be statically safe by Anonymous Coward · · Score: 4, Interesting

    You only need a peek to see this Laravel dubbed "PHP renaissance" does not even try to be statically safe. It's littered with pitfalls like writing your validators with strings, such as: "array('name' => array('required', 'min:5')), ...".

    (It is possible to write statically typed validators, with clean syntax (depending on language) and you end up not loosing stuff like auto-completion, semantic checking by IDE etc. See for instance latest Scala PlayFramework and it's JSON validation, it is relatively easy to use, and syntax is surprisingly succinct taken the fact it's extremely type-safe.)

  5. Really? by LizardKing · · Score: 4, Insightful

    With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands

    Citation please.

    1. Re:Really? by Anonymous Coward · · Score: 2, Interesting

      Yeah, I'd like a citation, too. I'm a RoR developer and had never heard of Laravel. Looking at the syntax in the Laravel quick-start brings back bad memories, though. PHP just isn't very good at DSLs.

    2. Re:Really? by Chris+Mattern · · Score: 4, Funny

      Citation please.

      Okay. How's this?

    3. Re:Really? by Anonymous Coward · · Score: 2, Funny

      I'm a RoR developer

      And you admit this publicly?

  6. What PHP needs now... by MikeRT · · Score: 3, Interesting

    Is for someone to write a new standard API that can sit in parallel to their old one that gives us sanity like string manipulation functions with real names and consistent parameters. You know stuff like:

    $x = string::indexOf($source, $needle);

    and

    $x = string::replaceAll($source, $needle, $regularExpression);

    1. Re:What PHP needs now... by Parker+Lewis · · Score: 2

      How about the obvious on OO?

      $x = $source->indexOf($needle);

      and

      $x = $source->replaceAll($needle, $regularExpression);

      ?

  7. Yeah, I'm sure by Trailer+Trash · · Score: 4, Insightful

    With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands...

    CodeIgnitor? Maybe. RoR? Um, no. Or, perhaps, in your dreams.

    As an RoR developer who left PHP years ago I assure you - we aren't just waiting for a really good PHP framework that's an RoR knockoff. Part of the greatness of Rails is Ruby, and looking through the Laravel docs just confirms that. It looks like Laravel is about as nice as you can get on PHP, but ultimately it's still PHP underneath (and on top).

    Rails is a meta-language built on top of Ruby. Just can't do that in PHP.

    And that's not even getting into the ugliness of PHP's cruft that's been built up over the years.

    1. Re:Yeah, I'm sure by ducomputergeek · · Score: 2

      There are RoR developers left? Seriously? I've not heard much about RoR after the $500k I made circa 2009/2010 coming in and cleaning up the mess on a few projects. Ironically enough it often involved rewriting projects mostly in PHP, but others in C# or Java, and even sometimes even with Perl. Granted most of the problem was non-developers reading how RoR does all this stuff automagically for them, they don't have to think or know, and turning out a blog in 15 minutes some how makes them a "developer".

      Truth be told, I still prefer Perl for a great many web-based tasks. Granted I spent the first 6 years of my career as a system admin who could code enough to make it work. I still use Perl today, especially for a lot of unsexy backend tasks. Hell I have scripts written circa 2001 that still work. Granted a lot have to do with log parsing, backups, *iux base load monitoring and other unsexy stuff, but they still work.

      I remember starting a project circa 2007. I was the oldest of the developers, really I was the server/networking guru of the team, there in my late twenties, the others were "hotshots" under the age of 25. They spent a week debating which PHP framework they should use to build an API. I got pissed, went home that weekend, and wrote version 1 in Perl on a Sunday Afternoon, granted with lots of help from CPAN. Long story short, two weeks later we turned out a working API in Perl. In 2009 we added JSON support in a couple days and as far as I know that API is still in production, still being used to process 100,000 transactions an hour.

      --
      "The problem with socialism is eventually you run out of other people's money" - Thatcher.
  8. A public thank you to the PHP team by Boss,+Pointy+Haired · · Score: 5, Insightful

    Yes it has its flaws, yes you sometimes don't know whether you're looking for needles in haystacks or haystacks in needles, but it's not like they're not aware of that, and it's not really a big deal either in these days of syntax and function aware editors and instant online reference, and it has provided me and i'm sure many thousands of other people with a career not just in contract coding but also in being used almost exclusively on our own websites.

    Thanks guys!

  9. Re:Why not make dollar signs optional? by TheSpoom · · Score: 2

    Yes, why NOT rewrite the entire language tokenizer for vague reasons of potentially avoiding a single keystroke?

    --
    It's better to vote for what you want and not get it than to vote for what you don't want and get it.
    - E. Debs
  10. Guilty pleasures by EmperorOfCanada · · Score: 5, Interesting

    I have two guilty pleasures: Watching the show COPS, and programming in PHP.

    I dream about getting away from PHP and occasionally dip my toes in other waters (Python, Java, and even C++) but always come back to PHP. I won't go to Ruby for as many websites start with Ruby and then abandon it for many other languages. People blah blah about MVC but often what I am doing is just too damn simple to need such added complexity. I might need a program that I occasionally run to view a list of spam flagged submissions; it is done in 10 minutes in PHP. I don't use any frameworks and am diligent enough to keep things running through prepared statements and whatnot. With opcode caching and memory caching of data PHP is very very fast.

    It is not so much that PHP is the best at anything it is that it isn't really terrible at anything I care about. Almost every other language is terrible at at least one thing that I do care about.

    Personally I think that PHP gets its bad rap because it is a very easy transition from HTML. So you have basically non programmers starting to sprinkle PHP into their HTML and oddly enough an untrained programmer's first efforts end up being crap. Then because PHP covers all the web server basics these programmers potentially never venture beyond PHP and there is nothing better for making a bad programmer than a one language programmer. (Not someone who primarily programs in one language but one who only ever learned the one language) So these same programmers keep expanding the scope of their terrible code.

    So if anyone can suggest a programming language to replace PHP I would love to know (and all JVM languages are off my list).

    1. Re:Guilty pleasures by Samantha+Wright · · Score: 5, Informative

      There are a lot of very real technical reasons why people don't like PHP. The syntax and naming of its function library is inconsistent, the type coercion is irregular, and it's inconsistent about warnings vs. errors—it tends to keep executing code even when it shouldn't, potentially leading to unwanted behaviour during development if a variable isn't set or something. Reddit has a fairly active board devoted to the various problems that can occur, not all of them avoidable.

      One of the most peculiar details in all of this is that PHP's original author (and, I think, but don't quote me on this, a portion of the development staff) considers himself a non-programmer; that PHP was just thrown together to simplify work. That would be okay, but it's led to a lot of security holes, bugs, and irreversible bad choices over the years, like having to use === in string parsing because false is returned by strpos() if it doesn't find anything (and false == 0). No other language requires this particular quirk.

      I don't blame you for not liking Ruby. While it's a much cleaner language, it's got some very peculiar syntactical features that make a lot of people scratch their heads—most notably, there are circumstances under which return doesn't work normally, which can be very frustrating. However, there are some very creative uses of familiar syntax that, for example, make strings really easy to work with; haystack['needle'] = 'thread' is the same as $haystack = str_replace('needle', 'thread', $haystack) in PHP. I haven't used it personally, but I think the major reason Ruby projects get abandoned so much is because the people writing code in it are not experienced programmers.

      Running down the list a little and hopping over JVM stuff, the other decent web languages you may want to consider are Perl and Python. Both have extremely well-developed libraries and are good with strings, so it's mostly just a question of picking "esoteric and terse" vs. "newbie-friendly and easily maintained." Decent JVM languages include JWT, Scala, and Clojure (with noir; check out that sexy beast), although JWT is probably overkill for anything smaller than Gmail.

      --
      Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
    2. Re:Guilty pleasures by Bigbutt · · Score: 2

      Actually I'm in the same boat. PHP works fine for all the little things I do and even a few big things. I've tried poking at Ruby a little and wasn't interested enough to pursue it. While I've done C programming in the past (80's and 90's), and perl (90's and 00's), most of my more recent work is scripting in general; shell scripting, some perl stuff, and loads of PHP+MySQL+JavaScript.

      I have asked the same question in past PHP rant threads but with no response.

      [John]

      --
      Shit better not happen!
    3. Re:Guilty pleasures by columbus · · Score: 2

      I like your link to a page containig a picture of a hammer with a claw on both ends.

      I raise you a link to a page describing a pentagonal room. PHP: a fractal of bad design.
      http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

      I cant believe nobody has linked to that blog posting yet. It's a classic.

      --
      friends don't let friends teleport drunk
  11. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion