Skip to end of metadata
Go to start of metadata

<p>Matthew raised the idea of considering PHP 5.4 as the minimum required version for ZF2. The primary reasons:</p>

<ul>
<li>PHP 5.4 stable has been released, which means that once ZF2 is released, if we stick with PHP 5.3, we'd be pinning ourselves to an "old" release immediately.</li>
<li>Traits could greatly simplify some internals of ZF2. As examples: traits for Options, Events, and Brokers would lead to less and more maintainable code.</li>
<li>Additionally, adopting PHP 5.4 and fully using features such as traits will reduce the workload later (no need to refactor to use these features), and allow us to focus on new framework feature instead of language features.</li>
</ul>

<p>That said, there are some cons to doing this:</p>

<ul>
<li>Many popular linux/freebsd/etc. distributions will not be shipping PHP 5.4 in a long term support (LTS) edition in the foreseeable future. (Though ubuntu, debian, and fedora have indicated they will do so soon.) Couple this with the fact that many hosting providers are very conservative in updating versions, and we have a potential to lock out many developers due to version incompatibilities.</li>
<li>Many developers and companies have already started putting plans in place for 5.3 + ZF2; this changes the equation and adds additional overhead and time to migrations.</li>
<li>Many view the ".0" release as inherently unstable, and simply will not adopt until a few bugfix releases have dropped.</li>
</ul>

<p>Another potential route is to stick with 5.3 as our base version, but offer some forwards-compatible features for consumption by end users. As an example, we've already created a "ProvidesEvents" trait in the EventManager; this is not used in the framework itself, but end users may compose this trait into their classes in order to quickly provide eventing capabilties to their own classes. Providing features in this way would provide useful tools for PHP 5.4 users, with little expense to 5.3 users (there would be minimal support requirements for traits).</p>

<ac:macro ac:name="note"><ac:parameter ac:name="title">Vote is LOCKED</ac:parameter><ac:rich-text-body>
<p>The vote is embedded for now, but LOCKED, in order to present the items. However, we want to ensure that all the choices are understandable, and that interested parties have had a chance to discuss the options before committing to a vote.</p>

<p>Please comment on this poll, start a thread on the mailing list, or discuss in #zftalk.2.</p></ac:rich-text-body></ac:macro>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

What version of PHP should ZF2 target?
Choices Your Vote Current Result: (0 Total Votes) Voters

1) PHP 5.3

(0 votes, 0%)

2) PHP 5.4

(0 votes, 0%)

3) PHP 5.3, but offer Traits for end-user consumption if 5.4 is available

(0 votes, 0%)
All voters:
]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 02, 2012

    <p>Well, as I commented in the meeting and later in the irc channel, for me is a really concern to upgrade to 5.4 skipping 5.3. There is not problem in my spare time projects/websites to start using 5.4 as most of you guys do, but, for instance, at work we have over 20 servers that we are looking to upgrade from 5.2 to 5.3, but there are several projects (tons of lines of code) that would need refactoring in order to run on 5.3 (some of them not written in zf and doesn't work in 5.3), it's been a real challenge to make the business understand that zf2+5.3 is the way we should take, and zf2 is the real reason we want to upgrade 5.3; that said, companies accept to use 5.3 because it's a product now stable and mature (5.3.9 right now) and will let us start working using ZF2, but won't accept to use 5.4.0 when it's released. I think ZF2 must be and is a business oriented product, to skip 5.3, we are letting other frameworks to take that market; and small companies/websites that want to run their applications on less expensive infrastructures often depends on hosting companies that by this time are running 5.2, not even 5.3.</p>

    <p>By using 5.4, we are losing market to small businesses that depends on hostings and we are also losing market to other companies that must ensure security and stability before innovation. So, to me the option that makes more sense is #3, use 5.3 and let open the window to use 5.4 cool features.</p>

  2. Feb 02, 2012

    <p>So, it seems that using Traits in 5.4 would really help with the elegance of things.</p>

    <p>But traits are a pretty simple idea. Would it be possible to use them, and then use Zend/Code to compile a 5.3 version of ZF2? In the end, it would just be a matter of copying code from traits and pasting into classes to make them 5.3 compatible.</p>

    <p>Or is it really not that simple?</p>

  3. Feb 02, 2012

    <p>As a business oriented client, I would avoid any connection between Zend Framework 2 and PHP 5.4. Traits are nice, but I feel we should take our time to build a solid Framework that works well with PHP 5.3 <strong>only</strong>, and take an extra year to plan the optimal use of traits in the Framework. By then, PHP 5.4 acceptance will start to pick up, and we might have a better strategy for adding traits to ZF2. I agree with Aldemar and I think Zend Framework 2's acceptance with businesses should be a priority.</p>

  4. Feb 02, 2012

    <p>Cons have been listed by Aldemar, Matthew, Guillaume those I agree with. Be here are some pros in my interpretation:<br />
    1. Besides traits there are more very useful new features in 5.4: callable type hint, better closure support, array dereferencing just no name a few.<br />
    2. Those of you concerned about server side support, just think of Zend Server! I bet guys at Zend will roll out a 5.4 version rapidly. On the other hand we all have seen major moves from the cloud industry. I would be surprised if providers did not adopt quickly.<br />
    3. It's just my opinoin but I think PHP is mature for a vast upgrade cycle: hash collision vulnerability is a real pain in the back.<br />
    4. By the time ZF2 stable rolls out, PHP 5.4 has a good chance to be widely adopted.<br />
    5. PHP 5.4 promises further resource optimizations.</p>

    <p>Looking forward to others' comments, I think it is a major thing to decide.</p>

    1. Feb 03, 2012

      <p>I did not list any cons. I am all FOR using 5.4. I'm merely suggesting that it might be very easy to port a 5.3 version of ZF2 if it were built on 5.4. On the other hand, porting from 5.3->5.4 seems like it would be a whole lot more work.</p>

      <p>I'm also a business oriented client, and get the point behind keeping 5.3 users in the loop. But why does there need to be compromise if there are ways to make everybody happy?</p>

      <p>The guys at NodeJS took a similar move when they ported Node to windows. They rewrote it to work perfectly on windows, and then ported it to Unix. The end product ended up being even faster on windows than on Unix, but the new unix version had virtually no change in performance. Had they just 'ported' it to windows, all windows users would have suffered greatly. Why can't we have our cake and eat it too?</p>

      <p>Two of the main goals behind the development of ZF2 were simplicity and performance. Using 5.4 features will surely help achieve this. Why can't we have both?</p>

  5. Feb 06, 2012

    <p>I believe targeting php 5.4 would be a good thing in the long run and it outweighs some adoption pain in the beginning. By the time ZF2 will ship + few fix releases (many companies won't adopt .0 release anyway) PHP5.4 will have spread wide and far. This is also a chance to speed up 5.4 adoption. And that is a good thing.</p>

    <p>However I do agree with above comments that perhaps it would be possible to have 5.3 compatible build.</p>

    <p>for PHP 5.3:</p>
    <ul>
    <li>inject the traits directly into classes. Some traits usage guideline would be needed though in order to make this simple.</li>
    <li>short array notation can be expanded to old style</li>
    <li>closures can be converted to use a temporary variable for "$this"</li>
    <li>callable type hints removed.</li>
    </ul>

    <p>In any case ZF 2 in my opinion should move forward and NOT tie users and projects to older version of PHP possibly for years to come.</p>