Do You PHP はてブロ

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

PHP5.4で非互換・非推奨になった機能や関数をざっくりあぶり出すワンライナー

via. PHP: 下位互換性のない変更点 - ManualPHP: PHP 5.4.x で推奨されなくなる機能 - Manual

PHP5.4.0RC8ということでぼちぼち正式リリースされそうなPHP5.4.0ですが、PHP5.3の時と同じような感じでざっくりざっくり書いてみました。今回のバージョンアップではPHP5.2.x→PHP5.3.xのように大きなインパクトはあまりなさそうです。
以下、$SRC_DIRは適宜設定。

find $SRC_DIR -iname \*.php -print0 | xargs -0 grep -iwE '(break|continue) +\$|get_magic_quotes_gpc|get_magic_quotes_runtime|set_magic_quotes_runtime|array_combine|(abstract|and|array()|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|old_function|or|private|protected|public|static|switch|throw|try|use|var|while|xor) +(trait|callable|insteadof)|define_syslog_variables|import_request_variables|session_is_registered|session_register|session_unregister|mysqli_bind_param|mysqli_bind_result|mysqli_client_encoding|mysqli_fetch|mysqli_param_count|mysqli_get_metadata|mysqli_send_long_data|mysqli::client_encoding|mysqli_stmt::stmt|mysql_list_dbs|mcrypt_generic_end'

Symfony Standard Edition 2.0.10のvenderディレクトリに対して実行した場合。

$ SRC_DIR=vendor/
$ find $SRC_DIR -iname \*.php -print0 | xargs -0 grep -iwE '(break|continue) +\$|get_magic_quotes_gpc|get_magic_quotes_runtime|set_magic_quotes_runtime|array_combine|(abstract|and|array()|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|old_function|or|private|protected|public|static|switch|throw|try|use|var|while|xor) +(trait|callable|insteadof)|define_syslog_variables|import_request_variables|session_is_registered|session_register|session_unregister|mysqli_bind_param|mysqli_bind_result|mysqli_client_encoding|mysqli_fetch|mysqli_param_count|mysqli_get_metadata|mysqli_send_long_data|mysqli::client_encoding|mysqli_stmt::stmt|mysql_list_dbs|mcrypt_generic_end'
vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php:                array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php:                array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php:                    array_combine($class->identifier, array(array_values($ids)))
vendor/doctrine/lib/Doctrine/ORM/EntityRepository.php:            $id = array_combine($this->_class->identifier, $value);
vendor/doctrine/lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php:        $id = array_combine($this->_class->getIdentifierColumnNames(), $identifier);
vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:                    $this->_conn->delete($mapping['joinTable']['name'], array_combine($keys, $identifier));
vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:                        $this->_conn->delete($mapping['joinTable']['name'], array_combine($otherKeys, $identifier));
vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:        $id = array_combine($this->_class->getIdentifierColumnNames(), $identifier);
vendor/symfony/src/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php:     * @var callable
vendor/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/MonthChoiceList.php:        parent::__construct(array_combine($months, $months), 2, '0', STR_PAD_LEFT);
vendor/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php:                        array_combine($options['hours'], $options['hours']), 2, '0', STR_PAD_LEFT
vendor/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php:                        array_combine($options['minutes'], $options['minutes']), 2, '0', STR_PAD_LEFT
vendor/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php:                            array_combine($options['seconds'], $options['seconds']), 2, '0', STR_PAD_LEFT
vendor/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php:                        array_combine($options['years'], $options['years']), 4, '0', STR_PAD_LEFT
vendor/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php:                        array_combine($options['days'], $options['days']), 2, '0', STR_PAD_LEFT
vendor/twig/lib/Twig/Lexer.php:        $operators = array_combine($operators, array_map('strlen', $operators));
vendor/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php:    if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1)
vendor/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php:    if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1)
$ 

いくつか引っかかってますが、array_combine()の引数に空の配列を二つ指定したときの返り値がfalseではなくarray()になったことによるものです。