[wp-hackers] PHP 5.3 stress tests with WordPress - expecting a lot of emitted warnings

Matt Freedman speedboxer at gmail.com
Tue Jul 21 11:07:47 UTC 2009


The main thing that should be changed is to stop using functions that
were deprecated in PHP 5.3. This includes moving the few ereg (POSIX)
functions to preg (Perl) and putting a version check around
set_magic_quotes_runtime() (as it is no longer necessary in PHP 5.3).


On Tue, Jul 21, 2009 at 3:36 AM, Jacob Santos<wordpress at santosj.name> wrote:
> WordPress runs fine with stock install and a few plugins. I think the problem you are going to have is in plugins which are incompatible with PHP 5.3. However, given that a lot of plugins are PHP4 compatible as well, it is likely that they won't have any issues either.
>
> Question: There are unit tests for WordPress? I know about http://svn.automattic.com/wordpress-tests/, but those aren't unit tests. I consider unit tests to be without dependencies and most of the test cases have dependencies (although there are a few mocks which do isolate a few parts of the code). Something that relies on the execution of the application or project most decidably can not be called unit testing.
>
> * I do not believe there are any objects passed to any of the sorting functions in WordPress. If so, then they were incorrect long before PHP 5.3 and a bug report should be made.
>
> * The call_user_func() changes do not apply to WordPress, because the plugin API is procedural and not object-oriented. I do thank you for the info, because I do plan on writing an object-oriented plugin API and the closures bit will help out a great deal.
>
> * /{}/ is advanced enough that it isn't used and if it is, then using /[]/ for strings won't break anything in PHP5 and PHP4.
>
> If it doesn't work on PHP5.3 then a bug should be made to either the core or plugin Trac. The point is not to wait until people are using PHP5.3 to fix bugs as long as the bug fix does not break the requirements for PHP4.3, in any case, the reference bits can't be fixed or patched, because it will break PHP4 compatibility (well, there wouldn't be any errors or notices, it just won't work as intended).
>
> Whether or not theme and plugin authors are doing something that breaks on PHP5.3 is saying that they were doing something right in the first place (unless they were using references for PHP4 compatibility). I haven't seen anything overly advanced in any plugins or themes I've used (they might still be out there).
>
> As for notices, I've been using PHP 5.3 for several months now and have made a few bug reports on several noticable issues. Given that I wasn't using a test suite, I can't be entirely sure.
>
> --
> Jacob Santos <wordpress at santosj.name>
>
>
> On Tue, 21 Jul 2009 03:07:45 +0200
> Heiko Rabe <heiko.rabe at code-styling.de> wrote:
>
>> Did somebody run a full unit test across WordPress core functionality
>> with PHP 5.3 ?
>> Today i tried a test install of PHP 5.3 and i found a lot of plugins and
>> themes are failing and emitting a lot of warnings and errors now.
>> I could not proceed with whole WP tests yet but the most relevant
>> changes are:
>>
>>  * The newer internal parameter parsing API has been applied across all
>> the extensions bundled with PHP 5.3.x. This parameter parsing API causes
>> functions to return *NULL* when passed incompatible parameters. There
>> are some exceptions to this rule, such as the get_class()
>> <http://de.php.net/manual/en/function.get-class.php> function, which
>> will continue to return *FALSE* on error.
>>  * The call_user_func()
>> <http://de.php.net/manual/en/function.call-user-func.php> family of
>> functions now propagate /$this/ even if the callee is a parent class.
>>  * The array functions natsort()
>> <http://de.php.net/manual/en/function.natsort.php>, natcasesort()
>> <http://de.php.net/manual/en/function.natcasesort.php>, usort()
>> <http://de.php.net/manual/en/function.usort.php>, uasort()
>> <http://de.php.net/manual/en/function.uasort.php>, uksort()
>> <http://de.php.net/manual/en/function.uksort.php>, array_flip()
>> <http://de.php.net/manual/en/function.array-flip.php>, and
>> array_unique() <http://de.php.net/manual/en/function.array-unique.php>
>> no longer accept objects passed as arguments. To apply these functions
>> to an object, cast the object to an array first.
>>  * The behaviour of functions with by-reference parameters called by
>> value has changed. Where previously the function would accept the
>> by-value argument, a warning is now emitted and all by-ref parameters
>> are set to *NULL*.
>>  * Assigning the return value of new
>> <http://de.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.new>
>> by reference is now deprecated.
>>  * Call-time pass-by-reference is now deprecated.
>>  * The use of /{}/ to access string offsets is deprecated. Use /[]/
>> instead.
>>
>> http://de.php.net/manual/en/migration53.deprecated.php
>>
>> This may be important because some hoster/provider did start upgrading
>> their server during last 2 weeks. This is current not the majority but
>> in long terms there are more comming. Most of above named changes emit
>> now warnings or errors, so a proper working of whole WordPress may not
>> longer be given in all cases.
>>
>> Can we assume, that the latest version of WordPress 2.8.2 is still PHP
>> 5.3 compatible at all ?
>> If not, should this lead to a warning publication (especially adressed
>> to theme/plugin authors) ?
>>
>> regards
>>
>> Heiko Rabe
>> (www.code-styling.de)
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Matt Freedman
http://mattfreedman.ca/


More information about the wp-hackers mailing list