Welcome Guest, Not a member yet? Register   Sign In
PHP 6 Compatibility?
#1

[eluser]Dog Cow[/eluser]
Is CodeIgniter compatible with PHP 6?

I got some errors about initiating objects using the reference operator. Is there a work-around for this?
#2

[eluser]Rey Philip Regis[/eluser]
PHP 6? I don't know if PHP 6 does exist. When I visit www.php.net the latest version of PHP was only 5.2.8
#3

[eluser]cwt137[/eluser]
http://snaps.php.net/
#4

[eluser]Rey Philip Regis[/eluser]
Ohhh snapshots haha..This are not stable versions. Anyways can you post some of your code..That has errors..
#5

[eluser]moodh[/eluser]
The =& operator doesn't work in php6, so yes, CI needs to get rewritten when PHP6 gets released.
#6

[eluser]Dog Cow[/eluser]
I had run CodeIgniter on PHP 6.0.0-dev about a week before I posted this topic, so I already know what the result is. Then what was the point of posting this topic? Well, that was to collect any information or tips people have for PHP 6 and CI.

Anyway, here's what I found:

- Error with magic_quotes. Solution: easy, remove that line or add an @ in front.

- Error with creating a new object by reference. This was actually the bigger error, and the one I did more research on, since I knew about magic_quotes, but not this one. What I found out was that in the Minutes of the PHP Meeting in 2005, they decided to disallow this as they saw no reason for it. On another blog site, I read someone's comment mentioning that you might want to pass by reference on a LAMP server with 128MB of RAM, but otherwise, there is no reason.

Further investigation reveals that passing by reference uses less memory, because otherwise a complete copy of the object is created, thus instantly doubling RAM usage. When reading the CI source, I found a code comment stating the similar thing.

This bothers me, because I am at the start of converting an existing web site with quite a large proecdural code base to CI, a code-base which runs on PHP 5.2.x and PHP6.0.0-dev with no strict errors, notices, etc and with the typical page consuming barely over 1 MB and 0.04 secs total exec time. Now it would appear that in order to get similar results, or even any result from CI in PHP 6, I'd either need to adjust the code and use more memory, or somehow refactor CI so that the references aren't needed.

These are the two things that is causing me to worry about switching my site to CI: increased RAM usage and execution time, and the non-PHP 6 compliance.

Any input to this?
#7

[eluser]CtheB[/eluser]
Are you serious about this?

I think nobody is replying because the question is too easy...
Why updating to PHP6? Really... do me a favor... And start learning PHP5 first before tempting to update to PHP6 ... :|

Here is the oh so easy answer...

PHP4: =& Object get passed by reference
PHP4: = Object get passed by copy

PHP5: =& Object get passed by reference
PHP5: = Object also get passed by reference!
PHP5: __clone Object get passed by copy!

PHP6: =& returns an error
PHP6: = Object also get passed by reference!
PHP6: __clone Object get passed by copy!

So use = instead of =& and everything works (except if you are using PHP4, which you are not).

And please do not use magic quotes, also not in PHP5, 4 or 3:|
#8

[eluser]Mark Skilbeck[/eluser]
[quote author="CtheB" date="1236648281"]Are you serious about this?

I think nobody is replying because the question is too easy...
Why updating to PHP6? Really... do me a favor... And start learning PHP5 first before tempting to update to PHP6 ... :|

Here is the oh so easy answer...

PHP4: =& Object get passed by reference
PHP4: = Object get passed by copy

PHP5: =& Object get passed by reference
PHP5: = Object also get passed by reference!
PHP5: __clone Object get passed by copy!

PHP6: =& returns an error
PHP6: = Object also get passed by reference!
PHP6: __clone Object get passed by copy!

So use = instead of =& and everything works (except if you are using PHP4, which you are not).

and please do not use magic quotes, also not in PHP5, 4 or 3:|[/quote]

What a rude individual..
#9

[eluser]CtheB[/eluser]
Why?
#10

[eluser]drewbee[/eluser]
I can't wait for CI to stop supporting PHP4, to talk about going the other way. It has been released from PHP's grips... time to move on!




Theme © iAndrew 2016 - Forum software by © MyBB