You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by Ivan Habunek <iv...@gmail.com> on 2011/09/03 23:12:24 UTC

PHP 5.3 required

Hi one and all,

Just finished rewriting Syslog appender. While writing tests, I used
reflections to make private methods an properties public. This makes testing
much easier and more efficient.

However, some of the reflection methods used require PHP 5.3 2 or later. For
example, a vital one is:
http://www.php.net/manual/en/reflectionmethod.setaccessible.php

I have configured the syslog tests to be skipped if the required methods are
not present so people with older versions of PHP can still run tests, but
not the whole set.

Can we live with PHP 5.3.2+ being a requirement for running the whole set of
unit tests?

Regards,
Ivan

RE: PHP 5.3 required

Posted by Mi...@tieto.com.
Hi all,

    >> I agree with Michael.
    >>
    >> Even 1&1 and some other hoster does not provide 5.3 support
    >> yet. Of course, testing is not really necessary for production
    >> environment... but who knows what people out there are doing?
    >>
    >> And really I *wished* it would be different - I think at
    >> namespaces.
    >
    > The adoption of PHP 5.3 is really going slowly, and that is
    > slowly starting to be a serious issue. PHP 5.2 has reached end
    > of support in Dec 2010. That's close to a year ago now.

this is true, we should face the facts.

    > My point is that some 5.3. features allow for much better unit
    > tests.  Frankly, I'm not sure how to test option parsing for the
    > syslog appender using 5.2 without redesigning it in a way which
    > allows me to "peek" at some private member variables (for
    > example making the option parsing methods public). And that is
    > just not very good design...
    >
    > For some appender params it's easy to test. E.g. file
    > appender's "filename" parameter - just check if a file was
    > created at the right place. But syslog appender is specific, I
    > cannot easily read the syslog entry created by the appender
    > (especially in a way which would work on all platforms) to see
    > if the options were activated correctly.
    >
    > I still think it is better to use PHP 5.3 features where no
    > other approach gives good results. This means that people
    > testing on PHP 5.2 will have some skipped tests. Testing will
    > NOT fail on 5.2. Currently, they will also have skipped tests if
    > they don't have pdo_sqlite3 or mongodb extensions loaded (and a
    > mongodb server up and running).

Ok, I understand your point. Although I think your sqlite3/mongodb
argument addresses a slightly different case, I could live with test
relying on PHP 5.3 tests to be skipped.

Michael.

Re: PHP 5.3 required

Posted by Ivan Habunek <iv...@gmail.com>.
On 6 September 2011 10:55, Christian Grobmeier <gr...@gmail.com> wrote:
> Speaking on namespaces... one thing comes to my mind.
> Should we put log4php 2.x to maintenance only mode and create a
> log4php 3.x version supporting php 5.3 + namespaces?

I definately think we should do this, but not right now.

There is still some work required to clean the project up a bit: try
to remove all the legacy crap which is left over from the olden days,
get all our appenders to work as documented, implement a decent
configurator (working on it). Then when we have a bit more solid code
base with no major issues we can do as you suggest.

This means that we will:
a) give some more time for 5.3. to catch on
b) provide the multitudes of people still stuck on 5.2 with a better product
c) make maintaining two branches easier

Regarding the timing, I'm thinking maybe after 2.3? Well, depends on
what makes it into 2.2.

What do you think?

Regards,
Ivan

Re: PHP 5.3 required

Posted by Christian Grobmeier <gr...@gmail.com>.
>  This means that people testing on PHP 5.2
> will have some skipped tests. Testing will NOT fail on 5.2. Currently,
> they will also have skipped tests if they don't have pdo_sqlite3 or
> mongodb extensions loaded (and a mongodb server up and running).

Well, I could live with that actually. Didn't reckognize you meant that.

> Also, not all syslog tests depend on 5.3 features... just the important ones. :)

hehehehe :-)

> If you have a better solution for this particular problem, I'm listening.

Speaking on namespaces... one thing comes to my mind.
Should we put log4php 2.x to maintenance only mode and create a
log4php 3.x version supporting php 5.3 + namespaces?

Cheers

Re: PHP 5.3 required

Posted by Ivan Habunek <iv...@gmail.com>.
On 6 September 2011 10:14, Christian Grobmeier <gr...@gmail.com> wrote:
> I agree with Michael.
>
> Even 1&1 and some other hoster does not provide 5.3 support yet. Of
> course, testing is not really necessary for production environment...
> but who knows what people out there are doing?
>
> And really I *wished* it would be different - I think at namespaces.

The adoption of PHP 5.3 is really going slowly, and that is slowly
starting to be a serious issue. PHP 5.2 has reached end of support in
Dec 2010. That's close to a year ago now.

My point is that some 5.3. features allow for much better unit tests.
Frankly, I'm not sure how to test option parsing for the syslog
appender using 5.2 without redesigning it in a way which allows me to
"peek" at some private member variables (for example making the option
parsing methods public). And that is just not very good design...

For some appender params it's easy to test. E.g. file appender's
"filename" parameter - just check if a file was created at the right
place. But syslog appender is specific, I cannot easily read the
syslog entry created by the appender (especially in a way which would
work on all platforms) to see if the options were activated correctly.

I still think it is better to use PHP 5.3 features where no other
approach gives good results. This means that people testing on PHP 5.2
will have some skipped tests. Testing will NOT fail on 5.2. Currently,
they will also have skipped tests if they don't have pdo_sqlite3 or
mongodb extensions loaded (and a mongodb server up and running).

Also, not all syslog tests depend on 5.3 features... just the important ones. :)

If you have a better solution for this particular problem, I'm listening.

Best regards,
Ivan

Re: PHP 5.3 required

Posted by Christian Grobmeier <gr...@gmail.com>.
> from my point of view having PHP 5.3 as a requirement is not a good idea
> since some of the enterprise Linux distribution (for example SUSE and RedHat
> (at least up to RHEL 5.7 distributed since 2011-07)) still stick to PHP 5.1
> or 5.2. Therefore I’d prefer not to rely on PHP v5.3 just for supporting
> unit tests of Log4PHP at this time.

I agree with Michael.

Even 1&1 and some other hoster does not provide 5.3 support yet. Of
course, testing is not really necessary for production environment...
but who knows what people out there are doing?

And really I *wished* it would be different - I think at namespaces.

Cheers

>
>
>
> BR
>
> Michael.
>
>
>
> From: Ivan Habunek [mailto:ivan.habunek@gmail.com]
> Sent: Saturday, September 03, 2011 23:12
> To: Log4PHP Dev
> Subject: PHP 5.3 required
>
>
>
> Hi one and all,
>
> Just finished rewriting Syslog appender. While writing tests, I used
> reflections to make private methods an properties public. This makes testing
> much easier and more efficient.
>
> However, some of the reflection methods used require PHP 5.3 2 or later. For
> example, a vital one is:
> http://www.php.net/manual/en/reflectionmethod.setaccessible.php
>
> I have configured the syslog tests to be skipped if the required methods are
> not present so people with older versions of PHP can still run tests, but
> not the whole set.
>
> Can we live with PHP 5.3.2+ being a requirement for running the whole set of
> unit tests?
>
> Regards,
> Ivan



-- 
http://www.grobmeier.de

RE: PHP 5.3 required

Posted by Mi...@tieto.com.
Hi all,

from my point of view having PHP 5.3 as a requirement is not a good idea since some of the enterprise Linux distribution (for example SUSE and RedHat (at least up to RHEL 5.7 distributed since 2011-07)) still stick to PHP 5.1 or 5.2. Therefore I'd prefer not to rely on PHP v5.3 just for supporting unit tests of Log4PHP at this time.

BR
Michael.

From: Ivan Habunek [mailto:ivan.habunek@gmail.com]
Sent: Saturday, September 03, 2011 23:12
To: Log4PHP Dev
Subject: PHP 5.3 required

Hi one and all,

Just finished rewriting Syslog appender. While writing tests, I used reflections to make private methods an properties public. This makes testing much easier and more efficient.

However, some of the reflection methods used require PHP 5.3 2 or later. For example, a vital one is:
http://www.php.net/manual/en/reflectionmethod.setaccessible.php

I have configured the syslog tests to be skipped if the required methods are not present so people with older versions of PHP can still run tests, but not the whole set.

Can we live with PHP 5.3.2+ being a requirement for running the whole set of unit tests?

Regards,
Ivan