Do You PHP はてブロ

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

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

via. PHP: PHP 5.3.x で推奨されない機能 - Manual

もう、ざっくりざっくり。$SRC_DIRは適宜設定。

find $SRC_DIR -iname \*.php -print0 | xargs -0 grep -wE 'define_syslog_variables|register_globals|register_long_arrays|safe_mode|magic_quotes_gpc|magic_quotes_runtime|magic_quotes_sybase|(call_user_method|call_user_method_array|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|set_magic_quotes_runtime|session_register|session_unregister|session_is_registered|set_socket_blocking|split|spliti|sql_regcase|mysql_db_query|mysql_escape_string)\(|\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\{[0-9]+\}|(= *& *new)'

Symfony1.0.xの場合。

$ SRC_DIR=lib/symfony/; find $SRC_DIR -iname \*.php -print0 | xargs -0 grep -wE 'define_syslog_variables|register_globals|register_long_arrays|safe_mode|magic_quotes_gpc|magic_quotes_runtime|magic_quotes_sybase|(call_user_method|call_user_method_array|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|set_magic_quotes_runtime|session_register|session_unregister|session_is_registered|set_socket_blocking|split|spliti|sql_regcase|mysql_db_query|mysql_escape_string)\(|\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\{[0-9]+\}|(= *& *new)'
lib/symfony/helper/AssetHelper.php:    list($options['width'], $options['height']) = split('x', $options['size'], 2);
lib/symfony/helper/FormHelper.php:    list($options['cols'], $options['rows']) = split('x', $size, 2);
lib/symfony/util/Spyc.class.php:      else if ($ifchk{0} != '#' && substr($ifchk, 0, 3) != '---')
lib/symfony/util/sfFinder.class.php:    if ($str{0} == '/' && $str{strlen($str) - 1} == '/')
lib/symfony/util/sfFinder.class.php:    if ($path{0} == '/' || $path{0} == '\\' ||
lib/symfony/util/sfFinder.class.php:        (strlen($path) > 3 && ctype_alpha($path{0}) &&
lib/symfony/util/sfFinder.class.php:         $path{1} == ':' &&
lib/symfony/util/sfFinder.class.php:         ($path{2} == '\\' || $path{2} == '/')
lib/symfony/cache/sfFileCache.class.php:        set_magic_quotes_runtime($mqr);
lib/symfony/i18n/sfDateFormat.class.php:      if ($pattern{0} == "'" && $pattern{strlen($pattern) - 1} == "'")
lib/symfony/i18n/sfDateFormat.class.php:    if (isset($this->tokens[$token{0}]))
lib/symfony/i18n/sfDateFormat.class.php:      return $this->tokens[$token{0}];
lib/symfony/response/sfWebResponse.class.php:      $currentHeaders = split('/\s*,\s*/', $vary);
lib/symfony/response/sfWebResponse.class.php:      foreach (split('/\s*,\s*/', $cacheControl) as $tmp)
lib/symfony/vendor/propel-generator/classes/propel/engine/database/transform/XmlToAppData.php:                                          if ($xmlFile{0} != '/') {
lib/symfony/vendor/propel-generator/classes/propel/engine/platform/MysqlPlatform.php:           return mysql_escape_string($text);
lib/symfony/vendor/phing/util/FileUtils.php:                (strlen($filename) >= 2 && Character::isLetter($filename{0}) && $filename{1} === ':')) {
lib/symfony/vendor/phing/util/FileUtils.php:        if (strlen($filename) >= 2 && Character::isLetter($filename{0}) && $filename{1} === ':') {
lib/symfony/vendor/phing/util/FileUtils.php:                && !(strlen($path) >= 2 && Character::isLetter($path{0}) && $path{1} === ':')) {
lib/symfony/vendor/phing/util/FileUtils.php:        if (strlen($path) >= 2 && Character::isLetter($path{0}) && $path{1} === ':') {
lib/symfony/vendor/phing/util/FileUtils.php:            } else if ($path{1} == DIRECTORY_SEPARATOR) {
lib/symfony/vendor/phing/util/StringHelper.php:     * are all accessible using the $string{0} notation.
lib/symfony/vendor/phing/util/DirectoryScanner.php: * internally (like split()) are not used. Only the _fast_ string functions
lib/symfony/vendor/phing/util/PathTokenizer.php:        if (strlen($token) === 1 && Character::isLetter($token{0})
lib/symfony/vendor/phing/Phing.php:        if ($data_dir{0} != '@') { // if we're using PEAR then the @ DATA-DIR @ token will have been substituted.
lib/symfony/vendor/phing/Phing.php:        ini_set('magic_quotes_gpc', 'off');
lib/symfony/vendor/phing/Phing.php:        ini_set('register_globals', 'off');
lib/symfony/vendor/phing/lib/Zip.php:          if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG], $v_header['stored_filename'])) {
lib/symfony/vendor/phing/lib/Zip.php:          if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG],
lib/symfony/vendor/phing/lib/Capsule.php:        if ( !($file{0} == DIRECTORY_SEPARATOR || $file{0} == '/')
lib/symfony/vendor/phing/lib/Capsule.php:                && !($file{1} == ':' && ($file{2} ==  DIRECTORY_SEPARATOR || $file{2} == '/'))) {
lib/symfony/vendor/phing/system/util/Properties.php:            if ($line{0} == '#' or $line{0} == ';') {
lib/symfony/vendor/phing/system/io/UnixFileSystem.php:        if ($strPathname{0} === "~") {
lib/symfony/vendor/phing/system/io/UnixFileSystem.php:            if ($strPathname{1} === "/") { // like ~/foo => /home/user/foo
lib/symfony/vendor/phing/system/io/UnixFileSystem.php:        return (($pathname{0} === '/') ? 1 : 0);
lib/symfony/vendor/phing/system/io/UnixFileSystem.php:        if ($child{0} === '/') {
lib/symfony/vendor/phing/system/io/UnixFileSystem.php:        $hidden = (strlen($name) > 0) && ($name{0} == '.');
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        if ((strlen($p) > 0) && ($p{0} != $this->slash)) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:                    && $this->isSlash($strPath{0})
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:                    && $this->isSlash($strPath{1})) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:                    if (($sn == 2) && ($sb{1} === ':')) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:                    if (($sn === 1) && ($this->isSlash($sb{0}))) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        $c0 = $path{0};
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        $c1 = ($n > 1) ? $path{1} :
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:            if (($n > 2) && ($path{2}) === $slash) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        if (($cn > 1) && ($c{0} === $slash)) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:            if ($c{1} === $slash) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        if ((strlen($p) > 2) && ($p{2} === ':')) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        return ((($pl === 2) && ($p{0} === $this->slash)) || ($pl === 3) || ($pl === 1 && $p{0} === $this->slash));
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        $d = (string) $d{0};
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        $drive = (string) $drive{0};
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:        if (($pl === 2) && ($path{0} === $this->slash)) {
lib/symfony/vendor/phing/system/io/Win32FileSystem.php:            $drive = (string) $path{0};
lib/symfony/vendor/phing/tasks/ext/coverage/CoverageReportTask.php:                     $lines = split("<li>|</li>", $html);
lib/symfony/vendor/phing/tasks/ext/ZendCodeAnalyzerTask.php: * <b>var-use-before-def-global</b> - Global variable '%s' is used without being assigned. You are probably relying on register_globals feature of PHP. Note that this feature is off by default.
lib/symfony/vendor/phpmailer/class.phpmailer.php:        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
lib/symfony/vendor/phpmailer/class.phpmailer.php:        set_magic_quotes_runtime($magic_quotes);
lib/symfony/vendor/phpmailer/class.phpmailer.php:            // Can't use addslashes as we don't know what value has magic_quotes_sybase.
lib/symfony/vendor/pake/pakeGetopt.class.php:    if ($long_opt{0} == '-' && $long_opt{1} == '-')
lib/symfony/vendor/pake/pakeGetopt.class.php:      if ($short_opt{0} == '-')
lib/symfony/vendor/pake/pakeGetopt.class.php:      if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$this->long_options))
lib/symfony/vendor/pake/pakeGetopt.class.php:      elseif (strlen($arg) > 1 && $arg{1} == '-')
lib/symfony/vendor/pake/pakeGetopt.class.php:   * Will take care on register_globals and register_argc_argv ini directives
lib/symfony/vendor/pake/pakeFinder.class.php:    if ($path{0} == '/' || $path{0} == '\\' ||
lib/symfony/vendor/pake/pakeFinder.class.php:        (strlen($path) > 3 && ctype_alpha($path{0}) &&
lib/symfony/vendor/pake/pakeFinder.class.php:         $path{1} == ':' &&
lib/symfony/vendor/pake/pakeFinder.class.php:         ($path{2} == '\\' || $path{2} == '/')
lib/symfony/vendor/pake/pakeFunction.php:   ini_set('magic_quotes_runtime', false);
lib/symfony/vendor/pake/pakeYaml.class.php:        } elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
lib/symfony/vendor/propel/validator/MatchValidator.php:         if ($exp{0} !== '/' || $exp{strlen($exp)-1} !== '/' ) {
lib/symfony/vendor/propel/validator/NotMatchValidator.php:              if ($exp{0} !== '/' || $exp{strlen($exp)-1} !== '/' ) {
lib/symfony/vendor/propel/adapter/DBMSSQL.php:            $select_items = split(',',$modified_select);
lib/symfony/vendor/propel/adapter/DBMSSQL.php:        $order_columns = split(',',str_ireplace('order by ','',$order_by));
lib/symfony/vendor/propel/adapter/DBMSSQL.php:            $column = array_reverse(split("\.",$column));
lib/symfony/vendor/creole/drivers/mssql/MSSQLPreparedStatement.php:        // use this instead of magic_quotes_sybase + addslashes(),
lib/symfony/vendor/creole/drivers/odbc/adapters/ODBCAdapter.php:        // use this instead of magic_quotes_sybase + addslashes(),
lib/symfony/vendor/creole/drivers/pgsql/PgSQLResultSet.php:                     } elseif ($tok{0} === '{') { // we're inside a new sub-array
$ 

泣けてきそう><