Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Ideas Centre
Darth Wong
Registered User
Posts: 2398
Joined: Wed Jul 03, 2002 5:20 am
Location: Toronto, Canada
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Darth Wong » Wed Jan 27, 2010 4:44 pm

I don't mean to ask stupid questions but I'm not exactly a PHP guru, so I'm curious: what is it about PHP 5.2 that allows people to make much cleaner code, as people keep saying it will?
Not a three-foot tall green gnome in real-life: My home page.
My wretched hive of scum and villainy: http://bbs.stardestroyer.net/

Desdenova
Registered User
Posts: 646
Joined: Sat Feb 23, 2008 7:25 pm

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Desdenova » Wed Jan 27, 2010 4:46 pm

Aye, there's many a mod author (that is knowledgeable of PHP5 OOP of course) that has wanted PHP4 support dropped, because of its inferior nature.

marian0810
Former Team Member
Posts: 3011
Joined: Mon May 21, 2007 9:17 pm
Location: The Netherlands
Name: Marian
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by marian0810 » Wed Jan 27, 2010 5:44 pm

So how much trouble can you expect when you're on a server with PHP 5.1.2? :?
You and me, time and space. You watch us run!

User avatar
JimA
Community Team Leader
Community Team Leader
Posts: 7620
Joined: Thu Jul 31, 2008 5:54 am
Location: The Netherlands
Name: Jim Mossing Holsteyn
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by JimA » Wed Jan 27, 2010 5:46 pm

marian0810 wrote:So how much trouble can you expect when you're on a server with PHP 5.1.2? :?
Possibly some functions don't work anymore.

I personally don't know how much has changed between these PHP 5.1 and 5.2, but we will when developing code no longer keep in mind for possible issues with PHP versions lower than 5.2.
Image Jim Mossing Holsteyn - Community Team Leader
Knowledge Base | Documentation | Board rules

If you're having any questions about the rules/customs of this website, feel free to drop me a PM.

User avatar
3Di
Former Team Member
Posts: 13920
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by 3Di » Wed Jan 27, 2010 5:48 pm

Darth Wong wrote:I don't mean to ask stupid questions but I'm not exactly a PHP guru, so I'm curious: what is it about PHP 5.2 that allows people to make much cleaner code, as people keep saying it will?
The matter, I can say, it is not related to the 'cleaner code' or not, if you are able to read the code then indeed it is 'clean'. The matter stays where the comparison it is .. just in order to get immediately the point .. phpBB2 against phpBB3 .. so to speak.

I mean.. (if PHP => PHP5) is better, more secure, more 'codeable' than PHP4, that's it from a coder's view.

All of this does not relates in any way IMHO with the discussion value, because an announcement of such a kind IMO has been made in order to get a feedback about the new Development Management, something like 'we are not sure of.. or what...' that is not something good by my personal point of view.

And finally, really it is not considerable to have an host that gives you its services under PHP4 at the present time, me too I'm writing my MODs/codes with a basic IF condition: if you do not have PHP5, okay, you are on your own, my code will not work with PHP4.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
👨‍🏫 | Take a tour to | The Studio | 👨‍🏫

Desdenova
Registered User
Posts: 646
Joined: Sat Feb 23, 2008 7:25 pm

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Desdenova » Wed Jan 27, 2010 7:02 pm

Darth Wong wrote:I don't mean to ask stupid questions but I'm not exactly a PHP guru, so I'm curious: what is it about PHP 5.2 that allows people to make much cleaner code, as people keep saying it will?
Mainly what HoL said.
Highway of Life wrote:
Brainy wrote:I can't speak for the development team, but off the top of my head I can think of php version distribution, php module support, possibly introducing different kinds of errors/how to support it, backwards compatibility, is there actually anything to gain from requiring a higher php version?
PHP 5 functions and classes that don’t exist in earlier versions, no more wrapper needed, the ability to use the PHP 5 object model, abstract classes, interfaces, magic methods, autoload ability, constructors and destructors, class constants, static methods and properties, type hinting, passing objects by reference, new extensions that includes SimpleXML, DOM and XSL extensions, a ton of new hash functions, a bunch of new array functions including combine, diff, udiff, walk, uintersect, better date and time handling, str_split, the awesome new filter extension, JSON Extension, the Zip extension...

Anyway, I could go on and on, but that's a very short summary of what is available in PHP 5.2 that was not available in PHP4, it sure makes a lot less work for developers to only worry about supporting PHP 5.2. :)
PHP5's Object Oriented Programming is a significant step forward from the OOP that was in PHP4. There's a lot more control available for classes, and a lot more modern methods (such as using __call() in an object to catch calls to undefined methods...and making magic methods using it) that are now available.

If you take a look here...that shows all that is available now with PHP5's OOP.
http://php.net/manual/en/language.oop5.php

The page that used to exist for PHP4's OOP was a lot smaller, let me tell you.

User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Spokane, WA
Name: David Lewis
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Highway of Life » Wed Jan 27, 2010 10:15 pm

ToonArmy wrote:
Highway of Life wrote:[...] passing objects by reference [...]
Eh? You can do that in 4.
In PHP4, you have to use the & operator to be able to pass an object by reference. The functionality for PHP4 is that everything is passed by value, including objects. This has since changed in PHP5 where all objects are passed by reference.

Example:

Code: Select all

$cow = new animal();
$cow->species = 'Cow';

$horse = $cow;
$horse->species = 'Horse';

echo $cow->species;
// 'Horse' 
The above code was common in PHP4. In PHP5 if you need to duplicate an object, you must use the clone keyword. In PHP4, you would just assign the object to another variable.
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.

User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Spokane, WA
Name: David Lewis
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Highway of Life » Wed Jan 27, 2010 11:06 pm

JimA wrote:
marian0810 wrote:So how much trouble can you expect when you're on a server with PHP 5.1.2? :?
Possibly some functions don't work anymore.

I personally don't know how much has changed between these PHP 5.1 and 5.2, but we will when developing code no longer keep in mind for possible issues with PHP versions lower than 5.2.
There is actually quite a bit that has changed in PHP 5.2 from PHP 5.1
The new input filtering extension as I mentioned before, this is one of my favorite new extensions in PHP.
  • filter_has_var — Checks if variable of specified type exists
  • filter_id — Returns the filter ID belonging to a named filter
  • filter_input_array — Gets external variables and optionally filters them
  • filter_input — Gets a specific external variable by name and optionally filters it
  • filter_list — Returns a list of all supported filters
  • filter_var_array — Gets multiple variables and optionally filters them
  • filter_var — Filters a variable with a specified filter
JSON Extension added and enabled by default.
ZIP extension for creating and editing zip files.
Hooks for tracking file upload progress.
New DateTime and DateTimeZone objects.
And a bunch of other smaller changes, fixes and performance improvements.
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.

ToonArmy
Former Team Member
Posts: 4608
Joined: Sat Mar 06, 2004 5:29 pm
Location: Worcestershire, UK
Name: Chris Smith
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by ToonArmy » Thu Jan 28, 2010 12:53 am

Highway of Life wrote:This has since changed in PHP5 where all objects are passed by reference.
Except your example has no passing.

The actual change is that object variables are just identifiers to the object in memory.
Chris SmithBlogGitHub
Image
In a foreign field he lay. Lonely soldier unknown grave. On his dying words he prays. Tell the world of Paschendale.

User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Spokane, WA
Name: David Lewis
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Highway of Life » Thu Jan 28, 2010 1:21 am

ToonArmy wrote:Except your example has no passing.
In PHP5, you do not need the & operator to pass objects by reference. My example demonstrates what happens when you assign an object to another variable and how that has changed between PHP4 and PHP5. In PHP5, objects are passed by reference, and in my example, that code if used within PHP4 would duplicate the object.

In PHP 5, the new variable is just an extra name (an alias, if you like) for the original variable, so that if you change the original object after doing the assignment, in reality you're changing both. So that when you look up a property in the copy, you'll be given the value that you have just set in the original.

Assignments copy references in PHP5 (which is correct OO behavior) but they duplicate or clone the object in PHP4. If you duplicate an object and then change one of the copies, you do NOT effect the data referred to by the other name (PHP4 behavior). If you copy by reference (PHP5 behavior, in effect giving the object a second name) and then change one of the "copies", you effect both as they are one and the same.
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.

jakk
Registered User
Posts: 31
Joined: Sun Jun 21, 2009 4:03 am
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by jakk » Thu Jan 28, 2010 3:48 am

ok, no problem, i'm used 5.2.12 :)
ivemfinity.com | mundoforeros.com | support team member phpbb-es.com (Soporte en español)

User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29248
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Marshalrusty » Thu Jan 28, 2010 4:05 am

Highway of Life, you keep saying "passing", but Chris is pointing out that the change is not with the action of passing, but with the very foundation of object variables. In the example you provided, no actual passing is taking place.

The fact that passing is now done by reference (by default) is the effect of object variables being handled in what I would consider the "proper" way, So again, it is not passing that has changed.

In your example, you show that $horse takes on the value of $cow. This has not changed. What has changed is that $cow is now only a reference to an existing object and not treated as the object itself. Thus, you would need to dereference $cow if you actually wanted the object. On the other hand, in prior versions, you would have to reference $cow if you didn't want the actual object.

Bottom line: the change to passing is the effect, not the cause :)
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs

User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Spokane, WA
Name: David Lewis
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by Highway of Life » Thu Jan 28, 2010 5:07 am

Passed by Reference
This is one of the most important innovations in PHP 5. In PHP 4 everything, including objects, was passed by value. This has been changed in PHP 5 where everything is passed by reference. I’m not making this up, go look it up on php.net, I happen to know what I’m talking about. It will only take you a few seconds of searching to verify everything I have said. :)
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.

User avatar
mtotheikle
Registered User
Posts: 188
Joined: Thu Sep 25, 2008 5:32 am
Location: Spokane, WA
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by mtotheikle » Thu Jan 28, 2010 5:58 am

While the example shows no passing by reference, which is only done in functions or different object methods, the example does show what PHP has changed as far OOP. We now get a more expected result from the example that David provided, or if was pass objects through functions, everything is just a reference pointer to the object stored in memory like ToonArmy pointed out.

Code like

Code: Select all

<?php
function my_cool_function(&$object) 
{
    $object->data = 'test';
}

$object = new object();
$object->data = 'blank';
echo $object->data;
// blank

my_cool_function($object);
echo $object->data;
// Test
 
Can now be replaced with

Code: Select all

<?php
function my_cool_function($object)
{
    $object->data ='test';
}

$object = new object();
$object->data = 'blank';
echo $object->data;
// blank

my_cool_function($object);
echo $object->data;
// Test
 
Both these code examples will generate the same result of course, we now just dont have to worry about the "&" sign.
New to phpBB3? Want to learn about programing? Then phpBB Academy is the place for you!

No support via PM, I will not respond!

Image

ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: Discuss: phpBB 3.1 discontinues support for PHP < 5.2

Post by ckwalsh » Thu Jan 28, 2010 6:01 am

1. Does it really matter? It would be a shame to have the discussion topic for an announcement locked due to it getting off topic/hostile.

2.
naderman wrote:You may discuss the announcement about dropping support for PHP versions below 5.2 in this topic.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.

Locked

Return to “phpBB Discussion”