Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Upgrading php [RSS Feed]

#1 Nov. 18, 2005 00:45:05

Todd R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


I'd been ignoring the "curly braces" thread, but then I grepped my
code and ... sure enough, I have curly braces that are used to index
into strings. I don't care about this philosophically, but it makes
me wonder about upgrade tools. I know I shouldn't ask this without
volunteering to do it myself, but when a version of php comes out
that makes such a change, is there any chance of having a tool that
updates the code available at the same time?

It seems to me that nothing understands php user code better than the
core php code, so perhaps a tool could be written that uses the guts
of php as a base. I suppose there are some IDEs that could do the
job as well. Sadly, I still use vi, but I bet if something were written
for emacs or eclipse, most people (even me) could learn to use it.
I'm dreading going to php5. I hear that to avoid warnings/notices
I'll need to convert a bunch of "var"s to "public"s. I'll need to
wrap my "get_class"s with "strtolower"s. etc.

It would be so wonderful to throw all my code at a tool that would
change everything that can be easily changed and give me a list of
spots I need to look at manually. A lot of the changes don't take
an overwhelming amount of time to do myself, but when you think
about the thousands of users all doing the same conversions, it just
makes sense for there to be a tool. It might also have the side
benefit of reducing long threads about breaking old code.

Perhaps this already exists and I've missed it. Perhaps it will
never exist because it isn't enough fun to write. Just an idea...

- Todd

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 18, 2005 00:48:10

Rasmus L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


Todd Ruth wrote:I'd been ignoring the "curly braces" thread, but then I grepped my
code and ... sure enough, I have curly braces that are used to index
into strings. I don't care about this philosophically, but it makes
me wonder about upgrade tools. I know I shouldn't ask this without
volunteering to do it myself, but when a version of php comes out
that makes such a change, is there any chance of having a tool that
updates the code available at the same time?

It seems to me that nothing understands php user code better than the
core php code, so perhaps a tool could be written that uses the guts
of php as a base. I suppose there are some IDEs that could do the
job as well. Sadly, I still use vi, but I bet if something were written
for emacs or eclipse, most people (even me) could learn to use it.
I'm dreading going to php5. I hear that to avoid warnings/notices
I'll need to convert a bunch of "var"s to "public"s. I'll need to
wrap my "get_class"s with "strtolower"s. etc.

It would be so wonderful to throw all my code at a tool that would
change everything that can be easily changed and give me a list of
spots I need to look at manually. A lot of the changes don't take
an overwhelming amount of time to do myself, but when you think
about the thousands of users all doing the same conversions, it just
makes sense for there to be a tool. It might also have the side
benefit of reducing long threads about breaking old code.

Perhaps this already exists and I've missed it. Perhaps it will
never exist because it isn't enough fun to write. Just an idea...This is what the E_STRICT messages are for. If you turn them on (in PHP5) you will get very specific messages about language-level issues inyour code.-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 18, 2005 00:54:51

Andi G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


Hi Todd,I'm hoping that in future we can provide better tools for upgradingin between versions. Both from an auto-conversion perspective andjust scanning the code statically and printing out warnings on whatcode to check. Coupled with better upgrading docs I think we'dimprove the current situation significantly.Main problem is that currently there haven't been the people to getit done. We did write some upgrading docs for 5.1 (not sure if theymade it into the RC but they can always make it to the site), butthis whole area needs a lot more work and help.Andi

At 04:44 PM 11/17/2005, Todd Ruth wrote:I'd been ignoring the "curly braces" thread, but then I grepped my
code and ... sure enough, I have curly braces that are used to index
into strings. I don't care about this philosophically, but it makes
me wonder about upgrade tools. I know I shouldn't ask this without
volunteering to do it myself, but when a version of php comes out
that makes such a change, is there any chance of having a tool that
updates the code available at the same time?

It seems to me that nothing understands php user code better than the
core php code, so perhaps a tool could be written that uses the guts
of php as a base. I suppose there are some IDEs that could do the
job as well. Sadly, I still use vi, but I bet if something were written
for emacs or eclipse, most people (even me) could learn to use it.
I'm dreading going to php5. I hear that to avoid warnings/notices
I'll need to convert a bunch of "var"s to "public"s. I'll need to
wrap my "get_class"s with "strtolower"s. etc.

It would be so wonderful to throw all my code at a tool that would
change everything that can be easily changed and give me a list of
spots I need to look at manually. A lot of the changes don't take
an overwhelming amount of time to do myself, but when you think
about the thousands of users all doing the same conversions, it just
makes sense for there to be a tool. It might also have the side
benefit of reducing long threads about breaking old code.

Perhaps this already exists and I've missed it. Perhaps it will
never exist because it isn't enough fun to write. Just an idea...

- Todd

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#4 Nov. 18, 2005 01:09:20

Todd R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


On Thu, 2005-11-17 at 16:47 -0800, Rasmus Lerdorf wrote:
> Todd Ruth wrote:
...
> > It would be so wonderful to throw all my code at a tool that would
> > change everything that can be easily changed and give me a list of
> > spots I need to look at manually. A lot of the changes don't take
> > an overwhelming amount of time to do myself, but when you think
> > about the thousands of users all doing the same conversions, it just
> > makes sense for there to be a tool. It might also have the side
> > benefit of reducing long threads about breaking old code.
> >
> > Perhaps this already exists and I've missed it. Perhaps it will
> > never exist because it isn't enough fun to write. Just an idea...
>
> This is what the E_STRICT messages are for. If you turn them on (in PHP
> 5) you will get very specific messages about language-level issues in
> your code.
>
> -Rasmus

I appreciate those messages. There are probably things that come up
at runtime for which the E_STRICT messages are the only good option.
(My guess is that it would be too much trouble to make a version of
php that rewrites my source code on the fly. ;) )

On the other hand, my current upgrade approach is:
- go to the new version
- try to use all of my code paths and copy and paste the notices
to a file
- sed the file into a list of vi commands that take me to every
line that generated a message
- after recognizing the pattern for the simple fixes, define
macros to do most of the work
- Try to maintain consciousness while applying the macros over and
over again.

If I weren't nearly the last person on the planet to upgrade, it
would be useful for me to at least post my vi macros somewhere.
Perhaps if other people are following a similar approach, they
could post whatever they use to get them over hurdles. The hope
in my original email is that if php is clever enough to give
me a message, it might be clever enough to just make the change
too.

I appologize again for bringing this up without providing any tools.
I just wanted to make sure it was considered. Maybe there could
be a spot on php.net where people are encouraged to post (or at
least post links to) what helped them get through php transitions.

Thanks again,
Todd

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 18, 2005 04:29:12

Ilia A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


Todd Ruth wrote:
> The hope
> in my original email is that if php is clever enough to give
> me a message, it might be clever enough to just make the change
> too.

A scripting language is not a spell checker, you can forget about it
auto-correcting your code. The E_STRICT/E_NOTICE messages are emitted to
notify the developer something is not quite right, so that they can make
the appropriate changes to future proof their code.

Ilia

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#6 Nov. 18, 2005 08:09:37

Jani T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


On Thu, 17 Nov 2005, Andi Gutmans wrote:I'm hoping that in future we can provide better tools for upgrading in betweenversions. Both from an auto-conversion perspective and just scanning the codestatically and printing out warnings on what code to check. Coupled withbetter upgrading docs I think we'd improve the current situationsignificantly.We already have the scanner:

# php -derror_reporting=4095 -l script_to_check.php

Strict Standards: Usage of {} to access string offsets is deprecated and
will be removed in PHP 6 in t.php on line 6
No syntax errors detected in t.php

With a simple shell script you can create a list of files having
any errors/warnings/notices/strict.. :)

At work we use a syntax checker script run whenever we commit files
to our CVS repository to catch any errors early..this reminded me to
fix that script to catch notices and such too. :)

--Jani

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#7 Nov. 18, 2005 08:20:28

Lukas S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


Ilia Alshanetsky wrote:Todd Ruth wrote:The hope
in my original email is that if php is clever enough to give
me a message, it might be clever enough to just make the change
too.A scripting language is not a spell checker, you can forget about it
auto-correcting your code. The E_STRICT/E_NOTICE messages are emitted to
notify the developer something is not quite right, so that they can make
the appropriate changes to future proof their code.Sounds like a feature someone could stick into their IDE or bytecodecache. However providing scripts to clean up language changes as a phpscript sounds like something that could be done if someone finds the time.For now it really sounds like a great business opportunity to me :-)

regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#8 Nov. 18, 2005 13:38:29

Steph F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


Jani, I'm going to slip that into the upgrade notes - I wasn't aware you
could do this 'til now either!

----- Original Message -----
From: "Jani Taskinen" <>
To: "Andi Gutmans" <>
Cc: <>; <intern***@*ists.php.net>
Sent: Friday, November 18, 2005 8:06 AM
Subject: Re: Upgrading php


> On Thu, 17 Nov 2005, Andi Gutmans wrote:
>
> > I'm hoping that in future we can provide better tools for upgrading in
between
> > versions. Both from an auto-conversion perspective and just scanning the
code
> > statically and printing out warnings on what code to check. Coupled with
> > better upgrading docs I think we'd improve the current situation
> > significantly.
>
> We already have the scanner:
>
> # php -derror_reporting=4095 -l script_to_check.php
>
> Strict Standards: Usage of {} to access string offsets is deprecated and
> will be removed in PHP 6 in t.php on line 6
> No syntax errors detected in t.php
>
> With a simple shell script you can create a list of files having
> any errors/warnings/notices/strict.. :)
>
> At work we use a syntax checker script run whenever we commit files
> to our CVS repository to catch any errors early..this reminded me to
> fix that script to catch notices and such too. :)
>
> --Jani
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#9 Nov. 18, 2005 13:44:48

Jani T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


On Fri, 18 Nov 2005, Steph Fox wrote:Jani, I'm going to slip that into the upgrade notes - I wasn't aware you
could do this 'til now either!

----- Original Message -----
From: "Jani Taskinen" <>
To: "Andi Gutmans" <>
Cc: <>; <intern***@*ists.php.net>
Sent: Friday, November 18, 2005 8:06 AM
Subject: Re: Upgrading phpOn Thu, 17 Nov 2005, Andi Gutmans wrote:I'm hoping that in future we can provide better tools for upgrading inbetweenversions. Both from an auto-conversion perspective and just scanning thecodestatically and printing out warnings on what code to check. Coupled with
better upgrading docs I think we'd improve the current situation
significantly.We already have the scanner:

# php -derror_reporting=4095 -l script_to_check.php

Strict Standards: Usage of {} to access string offsets is deprecated and
will be removed in PHP 6 in t.php on line 6
No syntax errors detected in t.php

With a simple shell script you can create a list of files having
any errors/warnings/notices/strict.. :)

At work we use a syntax checker script run whenever we commit files
to our CVS repository to catch any errors early..this reminded me to
fix that script to catch notices and such too. :)

--Jani

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php--
Give me your money at @ <http://pecl.php.net/wishlist.php/sniper>
Donating money may make me happier and friendlier for a limited period!
Death to all 4 letter abbreviations starting with P!

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#10 Nov. 18, 2005 14:32:31

Jani T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Upgrading php


The shell script we use here at work can be found here:http://www.php.net/~jani/patches/syntax_check.sh.txtWe have this line in our CVSROOT/commitinfo file:

ALL $CVSROOT/CVSROOT/syntax_check.sh %r/%p %s

--Jani


On Fri, 18 Nov 2005, Steph Fox wrote:Jani, I'm going to slip that into the upgrade notes - I wasn't aware you
could do this 'til now either!

----- Original Message -----
From: "Jani Taskinen" <>
To: "Andi Gutmans" <>
Cc: <>; <intern***@*ists.php.net>
Sent: Friday, November 18, 2005 8:06 AM
Subject: Re: Upgrading phpOn Thu, 17 Nov 2005, Andi Gutmans wrote:I'm hoping that in future we can provide better tools for upgrading inbetweenversions. Both from an auto-conversion perspective and just scanning thecodestatically and printing out warnings on what code to check. Coupled with
better upgrading docs I think we'd improve the current situation
significantly.We already have the scanner:

# php -derror_reporting=4095 -l script_to_check.php

Strict Standards: Usage of {} to access string offsets is deprecated and
will be removed in PHP 6 in t.php on line 6
No syntax errors detected in t.php

With a simple shell script you can create a list of files having
any errors/warnings/notices/strict.. :)

At work we use a syntax checker script run whenever we commit files
to our CVS repository to catch any errors early..this reminded me to
fix that script to catch notices and such too. :)

--Jani

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php--
Give me your money at @ <http://pecl.php.net/wishlist.php/sniper>
Donating money may make me happier and friendlier for a limited period!
Death to all 4 letter abbreviations starting with P!

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support