Do You PHP はてブロ

Do You PHPはてなからはてブロに移動しました

PHP 5.4.0RC1 released for testing

リリースされました。


Hello!

Stas has packed PHP 5.4.0RC1 which you can find here:

http://downloads.php.net/stas/

The Windows team provides windows binaries which you find here:

http://windows.php.net/qa/

This is the first release candiate. No new features will be included before the final version of PHP 5.4.0. During the RC phase only bugfixes should be committed to the PHP_5_4 branch.

Please ensure that the release is solid and all things behave as expected! Please test this RC against your code base and report any problems you encounter or successful tests you've run.

The next release candidate will be released on November 24.

NEWSファイルを見るとバグFIX中心になっているようで、順調に行けば2週間後の2011/11/24に次のリリースとなるようです。
バグFIX中心なんですが、2つほど変更が入っています。1つ目は、暗黙的に配列が文字列に変換された場合にNoticeが発生するようになったというもの。細かいですが、開発時に役に立ちそうです。

 - General improvements:
 . Changed silent conversion of array to string to produce a notice. (Patrick)
$ sapi/cli/php -v
PHP 5.4.0RC1 (cli) (built: Nov 11 2011 12:19:20)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
$ 
$ cat array_to_string.php
<?php
$a= [1, 3, 5, 7, 9];
var_dump($a);
var_dump("array=" . $a);

$ 
$ sapi/cli/php -derror_reporting=32767 array_to_string.php
array(5) {
  [0]=>
  int(1)
  [1]=>
  int(3)
  [2]=>
  int(5)
  [3]=>
  int(7)
  [4]=>
  int(9)
}

Notice: Array to string conversion in ...
string(11) "array=Array"
$ 

で、もう1つの方は個人的には重要な変更と思ってます。

 - General improvements:
 . Added class member access on instantiation (e.g. (new foo)->bar()) support. (Felipe)

2年ほど前に見たことがあるようなないような感じですが、ようやく来ました。

$ sapi/cli/php -v
PHP 5.4.0RC1 (cli) (built: Nov 11 2011 12:19:20)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
$ 
$ cat access_on_instantiation.php
<?php
/**
 * Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in ...
 *
 * var_dump(new DateTime()->getTimestamp());
 */
var_dump((new DateTime())->getTimestamp());

$ 
$ sapi/cli/php -ddate.timezone=Asia/Tokyo access_on_instantiation.php
int(1320982436)
$ 

ソースコメントにもありますが、インスタンス化するコードを括弧で括る必要があるようです。