[livesupport-dev] php5 support on the way - welcome Stefan de Konink
  • please welcome Stefan de Konink (skinkie), who will also contribute to
    LiveSupport from now on. I gave him subverion write permissions, and at
    first he's going to work on LS migration to PHP5 (with the idea of
    creating a codebase that would work both on PHP4 and PHP5).

    I've also created a branch just for this very purpose, see here:
    http://code.campware.org/projects/livesupport/browser/branches/php5/


    to enhance this work, maybe it would be nice for all our
    PHP-knowledgable people (Tomas, Sebastian & Stefan) to draw up some
    guidelines on how to make sure PHP code works both on PHP4 and PHP5.
    this would ensure that after combing through the current code, all
    future code would work on both PHP versions as well...
  • 20 Comments sorted by
  • Nice, welcome Stefan!

    It seems my last posting about diff betw. PHP4 and PHP5 was partly wrong.
    The reference-instead-copy paradigma (or however this can be called) seems just related to objects, not standard types of variables. For objects I always used refereneces, so it should be easyer to make it compatible for PHP4 and PHP5.

    Stefan, do you have PHP4 and PHP5 running on same machine?

    Could campware offer an virtual server with PHP5?

    Sebastian
  • Sebastian Goebel wrote:
    > Stefan, do you have PHP4 and PHP5 running on same machine?
    I usually prefer just one in order to not make stupid mistakes (I have
    more projects to manage Wink but I do have a spare machine which can run both.

    > Could campware offer an virtual server with PHP5?
    Couldn't we start with code verficiation with commandline php4/5 and
    then checkout what works and what doesn't?


    I do have one question Wink What is the " vs ' policy? Sometimes " is used
    within preg for example and it seems usually is ' used. We all know that
    single quotes are considered faster because it doesn't parse special
    characters nor variables. But the use in Livesupport is a bit random.


    Stefan

    ps. For people wanting to write me in private, my key is attached this
    time only. Public signing can be done near The Hague or Amsterdam.
  • Sebastian Goebel wrote:
    > Nice, welcome Stefan!
    >
    > It seems my last posting about diff betw. PHP4 and PHP5 was partly wrong.
    > The reference-instead-copy paradigma (or however this can be called) seems just related to objects, not standard types of variables. For objects I always used refereneces, so it should be easyer to make it compatible for PHP4 and PHP5.

    good to hear.

    while I tried LS on PHP5 last week, I got some error messages, so the
    issues we have may be not that esotheric...

    anyway, I found some documentation here on compability issues:
    http://docs.php.net/en/migration5.html
  • >
    > > Could campware offer an virtual server with PHP5?
    > Couldn't we start with code verficiation with commandline php4/5 and
    > then checkout what works and what doesn't?
    >
    >

    I found why localizer´s Data class makes problem. There are a lot of static calls to it, so it seems $this is just undefined in PHP4, but PHP5 throw "Fatal error" outside an instance.

    Have to test the rest, but it should work fine, as far just objects are referenced by using =, variables are still copyed, which I was concerned about first.

    Command line is good idea for single scripts, especially I use good old PHPed which just need php binary without any webserver, and it works fine with PHP5 too.


    > I do have one question Wink What is the " vs ' policy? Sometimes " is used
    > within preg for example and it seems usually is ' used. We all know that
    > single quotes are considered faster because it doesn't parse special
    > characters nor variables. But the use in Livesupport is a bit random.

    Normally I use single quotas, but sometimes it makes sense to user double quotes, and mybee sometimes it is just a mistype. In my opinion this could cause not much more then zero dot something performance lost, so it makes no much sence to go throught all the code and correct it.
    But sure, use single quotas where double quatas not needet.

    Also sometimes I used tabs for code indent, but PEAR coding standard is 4 spaces, so I will take more care of this.


    Sebastian
  • After a fresh checkout of htmlUI I found all images are corrupted. They are handled as text-files. Even the executable property is still there, but my

    svn proplist -v logo_livesupport.png
    Properties on 'logo_livesupport.png':
    svn:executable : *
    svn:keywords : author date id revision
    svn:eol-style : native


    I guess the eol-style and the executable property have to be removed, so just keywords will left there. Right?

    Sebastian
  • Sebastian Goebel wrote:
    > After a fresh checkout of htmlUI I found all images are corrupted. They
    > are handled as text-files. Even the executable property is still there,
    > but my
    >
    > svn proplist -v logo_livesupport.png
    > Properties on 'logo_livesupport.png':
    > svn:executable : *
    > svn:keywords : author date id revision
    > svn:eol-style : native
    >
    >
    > I guess the eol-style and the executable property have to be removed, so
    > just keywords will left there. Right?

    no, you have to set the mime type of the files properly, see
    http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.2
  • Hi Sebastian,

    Remove all three properties. It should only have one property,
    svn:mime-type : image/png. (Of course different for the non-png files.)

    Unfortunately, you'll need to delete and put back all these files,
    because I screwed them up when I tried to fix their properties. It
    looks like svn propset does not work with remote URLs. Sad

    Ferenc


    Sebastian Goebel wrote:
    > After a fresh checkout of htmlUI I found all images are corrupted. They
    > are handled as text-files. Even the executable property is still there,
    > but my
    >
    > svn proplist -v logo_livesupport.png
    > Properties on 'logo_livesupport.png':
    > svn:executable : *
    > svn:keywords : author date id revision
    > svn:eol-style : native
    >
    >
    > I guess the eol-style and the executable property have to be removed, so
    > just keywords will left there. Right?
    >
    > Sebastian
    >
  • BTW, any file with an

    svn:keywords : author date id revision

    property is an error. It's either a text file, and then it must have

    svn:keywords : Author Revision URL

    instead, or it's a binary file, and then it must have

    svn:mime-type :

    plus possibly svn:executable : *, but nothing else.

    Ferenc
  • Booth client I have just allow to change propertys for single file.
    How did you correct the propertys on your files?
  • svn propset svn:mime-type "image/png" *.png

    Sebastian Goebel wrote:
    > Booth client I have just allow to change propertys for single file.
    > How did you correct the propertys on your files?
    >
    >
  • Ok, Ferenc already gave me the answer: command line is the place to do.
  • netfinity-2 (62.44.9.210) now runs PHP5.

    First Impression: htmlUI on PHP5 is quite slow, and need more memory:
    Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4864 bytes) in /opt/livesupport/lib/pear/Calendar/Week.php on line 118
    This is easy fixed by ini_set().

    I started correcting some things in htmlUI.

    Have seen that PEAR HTML_QuickForm on svn was not compatible, so I added version 3.2.5 to the repository. I am not sure about the install process of it, Tomas, can you please update the related Makefile?

    Sebastian
  • Sebastian Goebel wrote:
    > Have seen that PEAR HTML_QuickForm on svn was not compatible, so I added version 3.2.5 to the repository. I am not sure about the install process of it, Tomas, can you please update the related Makefile?

    you added it to the php5 branch, right? (and not the main trunk...)
  • On Sun, 2 Oct 2005, [UTF-8] Ákos Maróy wrote:

    > Sebastian Goebel wrote:
    > > Have seen that PEAR HTML_QuickForm on svn was not compatible, so I added version 3.2.5 to the repository. I am not sure about the install process of it, Tomas, can you please update the related Makefile?
    >
    > you added it to the php5 branch, right? (and not the main trunk...)

    I think he did the main trunk, the branch isn't changed much since I
    didn't commit yet.

    Stefan
  • > you added it to the php5 branch, right? (and not the main trunk...)

    No, my opinion is to have same version compatible with PHP4 and PHP5.
    PHP5 offers some new possibilities for better OO style. But no urge to use them yet, there are some other taks to make the code more nicely.

    Sebastian
  • Sebastian Goebel wrote:
    >>you added it to the php5 branch, right? (and not the main trunk...)
    >
    >
    > No, my opinion is to have same version compatible with PHP4 and PHP5.

    at the end - yes.

    but it will take some effort, and a lot of commits to make it work under
    PHP5. this why we need a separate branch - so that the main branch
    remains stable, and is not ruined.

    please only commit php5-related work to the php5 branch, see here:
    http://code.campware.org/projects/livesupport/browser/branches/php5/

    when that branch works OK with both php4 and php5, we will merge it back
    to the main trunk
  • On Sun, 2 Oct 2005 16:28:40 +0200 Sebastian Goebel wrote:
    > netfinity-2 (62.44.9.210) now runs PHP5.

    Great!
    but Wink
    there is some problem with standalone PHP interpreter - it's PHP4:
    tomash@LiveSupport-Station-Studio:~$ php -v
    PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)

    Some parts of install process run under this interpreter - we should
    have the same version there.

    > ...
    > Have seen that PEAR HTML_QuickForm on svn was not compatible, so I added version 3.2.5 to the repository. I am not sure about the install process of it, Tomas, can you please update the related Makefile?
    >
    > Sebastian

    OK - version changed to 3.2.5.

    This change should be in main trunk IMO (it's upgrade to latest stable
    version), but for other non-cosmetic changes I vote for php5 branch.

    Tomas Hlava
    th@red2head.com
  • php-cli on netfinity-2 is now version 5.0.5-1
  • There is really no need for PHP5-branch.
    It is already fixed (as far iI found bugs), and commited by one take. http://code.campware.org/projects/livesupport/changeset/1734

    You can delete php5-banch if you don´t insist of it.

    Sebastian



    > -----Ursprüngliche Nachricht-----
    > Von: Ákos Maróy [mailto:darkeye@tyrell.hu]
    > Gesendet: Sonntag, 2. Oktober 2005 19:29
    > An: livesupport-dev@campware.org
    > Betreff: Re: AW: AW: AW: [livesupport-dev] php5 support on the way -
    > welcome Stefan de Konink
    >
    >
    > Sebastian Goebel wrote:
    > >>you added it to the php5 branch, right? (and not the main trunk...)
    > >
    > >
    > > No, my opinion is to have same version compatible with PHP4 and PHP5.
    >
    > at the end - yes.
    >
    > but it will take some effort, and a lot of commits to make it work under
    > PHP5. this why we need a separate branch - so that the main branch
    > remains stable, and is not ruined.
    >
    > please only commit php5-related work to the php5 branch, see here:
    > http://code.campware.org/projects/livesupport/browser/branches/php5/
    >
    > when that branch works OK with both php4 and php5, we will merge it back
    > to the main trunk
    >
  • Sebastian Goebel wrote:
    > There is really no need for PHP5-branch.
    > It is already fixed (as far iI found bugs), and commited by one take. http://code.campware.org/projects/livesupport/changeset/1734
    >
    > You can delete php5-banch if you don´t insist of it.

    ok, now let's see how Tomas is doing with PHP5 compatbility..


    Akos