Giter VIP home page Giter VIP logo

php53to54's People

Contributors

danez avatar ephigenia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

kwn

php53to54's Issues

CSS files stop parsing?

it looks like css or js files stop the sniffing process … any css files in the source files seemes to stop the sniffing process.

Registering sniffs in PHP53to54 standard... DONE (13 sniffs registered)
Creating file list... DONE (655 files in queue)
Processing index.php [34 tokens in 18 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing wp-activate.php [745 tokens in 102 lines]... DONE in 1 second (0 errors, 0 warnings)
Processing about.php [1075 tokens in 209 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing admin-ajax.php [15818 tokens in 1591 lines]... DONE in 1 second (0 errors, 0 warnings)
Processing admin-footer.php [207 tokens in 47 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing admin-functions.php [43 tokens in 16 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing admin-header.php [879 tokens in 127 lines]... DONE in 1 second (0 errors, 0 warnings)
Processing admin-post.php [144 tokens in 33 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing admin.php [1887 tokens in 233 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing async-upload.php [623 tokens in 70 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing comment.php [2311 tokens in 299 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing credits.php [1409 tokens in 161 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing colors-classic.css [11226 tokens in 1 lines]... DONE in 48 seconds (0 errors, 0 warnings)
Processing colors-classic.dev.css 

and then it takes an eternity to finish with this. is there a way to ignore css files!?

PHP 5.4 Virtuelle Machine

Um ein Paar Funktionalitäten und Unklarheiten zu beseitigen wäre es super eine Virtuelle Umgebung mit PHP 5.4 zu haben in der man bestimmte Dinge testen kann (z. Bsp. #3). Kannst Du bitte ein Shell Script für eine normale Ubuntu Kiste erstellen welches automatisch PHP 5.4 installiert?

Generic: ForbiddenConstants Sniff

Es sollte einen generischen Test geben den man auch über die XML konfigurieren kann der nach der Verwendung von Konstanten sucht die man eingestellt hat. Diesen kann man dann zum Beispiel für #11 (SQLite Extension) benutzen. Da gibt es auch schon ein Beispiel drin.

SNMP now OOP API Only

SNMP now has an OOP API. Functions now return FALSE on every error condition including SNMP-related (no such instance, end of MIB, etc). Thus, in particular, breaks previous behavior of get/walk functions returning an empty string on SNMP-related errors. Multi OID get/getnext/set queries are now supported (Other Changes)

Dieser Sniff muss also nach Aufrufen auf die snmp_ Funktionen suchen, die jetzt alle false zurück geben.

Die Funktionen sind:

snmp_get_quick_print
snmp_get_valueretrieval
snmp_read_mib
snmp_set_enum_print
snmp_set_oid_numeric_print
snmp_set_oid_output_format
snmp_set_quick_print
snmp_set_valueretrieval
snmp2_get
snmp2_getnext
snmp2_real_walk
snmp2_set
snmp2_walk
snmp3_get
snmp3_getnext
snmp3_real_walk
snmp3_set
snmp3_walk
snmpget
snmpgetnext
snmprealwalk
snmpset
snmpwalk
snmpwalkoid

Magic-Quotes Removed

Backward Incompatible Changes

Magic quotes has been removed. Applications relying on this feature may need to be updated, to avoid security issues. get_magic_quotes_gpc() and get_magic_quotes_runtime() now always return FALSE. set_magic_quotes_runtime() raises an E_CORE_ERROR level error.

This sniff must search for get_magic_quotes_runtime(), get_magic_quotes_gpc, set_magic_quotes_runtime().

DRY für Namespace Detection in einigen Klassen

Wie schon in #26 erwähnt gibt es gibt DRY Code in den Klassen:

  • ForbiddenClassNamesSniff
  • ForbiddenConstantNamesSniff
  • ForbiddenInterfaceNamesSniff

Der redundante Code muss reduziert werden, konzepte dafür sind willkommen!

New Classes & Interfaces

There’s a list of new classes and interfaces that come with PHP 5.4. All these Classes and Interfaces are not allowed in the global namespace anymore.

    // SPL
    CallbackFilterIterator
    RecursiveCallbackFilterIterator

    // Reflection:
    ReflectionZendExtension

    // Json
    JsonSerializable

    // Session
    SessionHandler
    SessionHandlerInterface

    // Snmp
    SNMP

    // Intl
    Transliterator
    Spoofchecker

Was genau ist mit "TZ environment variable" gemeint?

In der Rubrik "Backward Incompatible Changes" (http://www.php.net/manual/en/migration54.incompatible.php) heißt es u.a.

In the date and time extension, the timezone can no longer be set using the TZ environment variable. Instead you have to specify a timezone using the date.timezone php.ini option or date_default_timezone_set() function. PHP will no longer attempt to guess the timezone, and will instead fall back to "UTC" and issue a E_WARNING."

Es sollte herausgefunden werden, was genau mit "TZ environment variable" gemeint ist. Wird eine spezielle Methode dafür verwendet oder setenv() mit einem definierten Parameter? Anhand dessen kann man dann den Code prüfen und entsprechend darauf hinweisen.

Test Installation

Es wäre super wenn Du mal testen könntest wie man den Sniffer installiert oder vorbereitet für den Release zum benutzen. Wir sind jetzt fast soweit dass man die erste Version freigeben könnte und da brauchen wir eine Installationsanleitung und noch andere Dinge?

header() TestScript

Wie in #16 von @reneoelke erwähnt, brauchen wir um die Auswirkungen vom Safe Mode auf die header Funktion zu testen ein Testscript um dann feststellen zu können was wir hier für einen Sniff programmieren müssen. Kannst Du das Testscript mal anlegen und schauen bitte?

htmlentities with asian character sets

If you use htmlentities() with asian character sets, it works like htmlspecialchars() - this has always been the case in previous versions of PHP, but now an E_STRICT level error is emitted. (Backwards Incompatibilty changes

Hier kann man wie in #33 einfach auf den dritten Parameter prüfen und gucken ob hier ein Asiatischer Zeichensatz angeben ist.

Ich hab auf Wikipedia mal nach asiatischen Schriftsätzen gesucht:

// from http://en.wikipedia.org/wiki/Character_set
Windows-1258    // Vietnamese
ISO 8859-11     // Thai
GB 2312         // Chinese Guobiao
GBK             // Chinese Guobiao
GB 18030        // Chinese Guobiao
Big5            // Taiwan Big5
KS X 1001       // Korean
KS C 5861       // 
EUC-KR          // Korean
ISO-2022-KR     // Korean
VISCII          // Vietnamese Standard Code for Information Interchange
EBCDIC 930      // Japanese EBCDIC code pages IBM
JIS X 0208      // Japanese character encoding
Shift JIS       // Japanese character encoding (Shift-JIS)
EUC-JP          // Japanese character encoding
ISO-2022-JP     // Japanese character encoding

Generator: HTML

Find out how to use the --generator=HTML option and/or anything to create HTML reports. Maybe also find out how to plug this into php_codesniffer.

Meldungen als Notices ausgeben

Momentan kann man in CodeSniffer nur Warnungen und Fehler ausgeben. Manchmal macht es aber Sinn, auch nur einfache Notices auszugeben (Bsp. siehe #44).

CodeSniffer sollte dahingehend erweitert werden, dass es eine Methode zum hinzufügen von Notices gibt (wie auch addError() und addWarning()). Außerdem wäre es sinnvoll, wenn man per CLI-Parameter nach Notices filtern kann (nur Notices anzeigen oder alles, außer Notices).

Usage as external Standard

There are problems using PHP53to54 as standalone standard when it comes to class loading and using the ruleset.xml with configuration. PHPCS does not seem to find the right class for `"ref="PHP53to54.Generic.ForbiddenClassNames"

If i run:

phpcs -p -v --standard=/Users/ephigenia/Sites/jagger/PHP53to54 ./

I get an error like this:

Registering sniffs in PHP53to54 standard... PHP Fatal error:  Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist' in /usr/lib/php/pear/PHP/CodeSniffer.php:814
Stack trace:
#0 /usr/lib/php/pear/PHP/CodeSniffer.php(730): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement))
#1 /usr/lib/php/pear/PHP/CodeSniffer.php(623): PHP_CodeSniffer->getSniffFiles('/Users/ephigeni...', 'PHP53to54')
#2 /usr/lib/php/pear/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('/Users/ephigeni...', Array)
#3 /usr/lib/php/pear/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, '/Users/ephigeni...', Array, false)
#4 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process()
#5 {main}
  thrown in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist' in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

PHP_CodeSniffer_Exception: Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist in /usr/lib/php/pear/PHP/CodeSniffer.php on line 814

Call Stack:
    0.0002     653752   1. {main}() /usr/bin/phpcs:0
    0.0089    2414608   2. PHP_CodeSniffer_CLI->process() /usr/bin/phpcs:37
    0.0096    2425704   3. PHP_CodeSniffer->process() /usr/lib/php/pear/PHP/CodeSniffer/CLI.php:551
    0.0097    2428240   4. PHP_CodeSniffer->setTokenListeners() /usr/lib/php/pear/PHP/CodeSniffer.php:438
    0.0097    2428384   5. PHP_CodeSniffer->getSniffFiles() /usr/lib/php/pear/PHP/CodeSniffer.php:623
    0.0141    2448312   6. PHP_CodeSniffer->_expandRulesetReference() /usr/lib/php/pear/PHP/CodeSniffer.php:730

Dump $_GET
Dump $_POST

Variables in local scope (#6):
  $error = 'Referenced sniff PHP53to54.Generic.ForbiddenClassNames does not exist'
  $isDir = FALSE
  $parts = array (0 => 'PHP53to54', 1 => 'Generic', 2 => 'ForbiddenClassNames')
  $path = FALSE
  $referencedSniffs = array ()
  $sniff = class SimpleXMLElement { 'PHP53to54.Generic.ForbiddenClassNames' }

Generic: forbiddenStaticMethods Sniff

Es sollte einen generischen Test geben in dem man über die XML Einstellungen angeben kann welche statischen Methoden von welchen Klassen nicht mehr erlaubt sind. Ein Array mit einer Liste der Objekte und deren Methoden könnte dabei zum Testen helfen.

So in etwa:

<?php
$invalidCalls = array(
    // für alle methoden auf dem objekt staticObject
    'staticObject' => array(
        '.+',
    ),
    // für nur bestimmte methoden
    'otherstatic' => array(
        'method1', 'method2',
    ),
);

Apache Compatible Functions for FastCGI SAPI

Added apache compatible functions: apache_child_terminate(), getallheaders(), apache_request_headers() and apache_response_headers() for FastCGI SAPI. (Changes in SAPI modules)

This function became available under FastCGI. Previously, it was supported only when PHP was installed as an Apache module.

Diese Funktionen sind jetzt also auch mit FastCGI / CGI Version kompatibel und erreichbar. Muss man hier überhaupt was sniffen? Ich glaube nicht oder?

Safe Mode INI Einstellungen suchen

in #16 @reneoelke

Man sollte prüfen, ob bestimmte Ini-Settings bzgl. safe_mode ausgelesen werden: safe_mode, safe_mode_gid, safe_mode_include_dir, safe_mode_exec_dir, safe_mode_allowed_env_vars, safe_mode_protected_env_vars. Wenn dem so ist, dann muss man eine entsprechende Meldung ausgeben. Ist zu klären, ob man eine Warnung oder einen Fehler ausgibt.

Ein Sniff schreiben der nach

  • safe_mode
  • safe_mode_gid
  • safe_mode_include_dir
  • safe_mode_exec_dir
  • safe_mode_allowed_env_vars
  • safe_mode_protected_env_vars

Sucht und dann eine Warning ausgeben, dass dieses Auslesen keinen Sinn mehr hat.

htmlentities default encoding UTF-8

The default character set for htmlspecialchars() and htmlentities() is now UTF-8, instead of ISO-8859-1. Note that changing your output charset via the default_charset configuration setting does not affect htmlspecialchars/htmlentities unless you are passing "" (an empty string) as the encoding parameter to your htmlspecialchars()/htmlentities() calls. Generally we do not recommend doing this because you should be able to change your output charset without affecting the runtime charset used by these functions. The safest approach is to explicitly set the charset on each call to htmlspecialchars() and htmlentities(). (Other Changes)

Hier könnte man doch einen Sniff schreiben der auf den dritten Parameter von htmlspecialchars, htmlentities prüft. Wenn dieser nicht gesetzt ist eine Warning ausgeben, dass sich das Default-Character Encoding geändert hat.

No Globals as Parameters

Backward Incompatible Changes lists that

Parameter names that shadow super globals now cause a fatal error. This prohibits code like function foo($_GET, $_POST) {}.

So usage of following variables as parameters should be wrong:

  • $GLOBALS
  • $_SERVER
  • $_GET
  • $_SET
  • $_FILES
  • $_COOKIE
  • $_SESSION
  • $_REQUEST
  • $_ENV

isset($_SESSION) -> session_status()

Details siehe http://de2.php.net/manual/en/function.session-status.php

Seit PHP 5.4 gibt es eine neue Funktion session_status(). Im aktuellen PHP-Magazin 4.12 ist ein interessanter Shortcut-Artikel (Seite 24) zu dem Thema. Statt isset($_SESSION) könnte man session_status() verwenden. Man müsste also nach dem Vorhandensein von isset($_SESSION) und eine entsprechende Meldung ausgeben. Allerdings sollte man die Meldung recht kurz halten.

PS: Weitere Details dann siehe Google Docs (Ergänzungen zu GitHub-Issues).

Removed Functions

Backward Incompatible Changes Removed Functions:

define_syslog_variables
import_request_variables
session_is_registered
session_register
session_unregister

Deprecated Features

mcrypt_generic_end
mysql_list_dbs

Removed Function-Aliases:

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

SNMP Other Changes

Dropped UCD-SNMP compatibility code, consider upgrading to net-snmp v5.3+, Net-SNMP v5.4+ is required for Windows version. In sake of adding support for IPv6 DNS name resolution of remote SNMP agent (peer) is done by extension now, not by Net-SNMP library anymore. (Other Changes)

Was kann das wohl bedeuten? Was muss man hier machen?

new Apache-Methods for FastCGI SAPI

Changes in SAPI modules

Added apache compatible functions: apache_child_terminate(), getallheaders(), apache_request_headers() and apache_response_headers() for FastCGI SAPI.

This sniff must check if there are functions defined in the global namespace that would lead to a collision:

  • apache_child_terminate()
  • getallheaders()
  • apache_request_headers()
  • apache_response_headers()

default_charset changed

Laut dem PHP Changelog hat sich die INI-Direktive default_charset von 'ISO-88591-1aufUTF-8` geändert:

Changed default value of "default_charset" php.ini option from ISO-8859-1 to UTF-8.

Der default_charset wird automatisch im Header der Response gesetzt. (siehe)

Sollte man hier vielleicht darauf prüfen ob der default_charset irgendwo ausgelesen wird oder welche funktionen hier beeinfluss werden?

Non-Numeric Offset on String

Non-numeric string offsets - e.g. $a['foo'] where $a is a string - now return false on isset() and true on empty(), and produce a E_WARNING if you try to use them. Offsets of types double, bool and null produce a E_NOTICE. Numeric strings (e.g. $a['2']) still work as before. Note that offsets like '12.3' and '5 foobar' are considered non-numeric and produce a E_WARNING, but are converted to 12 and 5 respectively, for backward compatibility reasons (Backwards Incompatibilty Changes)

Für solch einen Sniff müsste man auch wissen was in der entsprechenden Variable drin steht. Ist tendenziell schwierig.

Salsa10 & Salsa20 Hashing-Algorithms removed

Backward Incompatible Changes:

The Salsa10 and Salsa20 hash algorithms have been removed.

So all listed hash_-functions from the HASH Message Digest Framework must be checked if they are used with the salsa10 or salsa20 string as parameter:

  • hash_file
    string hash_file ( string $algo , string $filename [, bool $raw_output = false])
  • hash_hmac_file
    string hash_hmac_file ( string $algo , string $filename , string $key [, bool $raw_output = false])
  • hash_hmac
    string hash_hmac_file ( string $algo , string $filename , string $key [, bool $raw_output = false])
  • hash_init
    resource hash_init ( string $algo [, int $options = 0 [, string $key = NULL]])
  • hash
    string hash ( string $algo , string $data [, bool $raw_output = false])

$_SERVER AUTH-Variables

#16 von @reneoelke

Die $_SERVER-Variablen PHP_AUTH_USER, PHP_AUTH_PW und AUTH_TYPE stehen bei aktivem safe_mode nicht zur Verfügung. Stattdessen kann man aber noch REMOTE_USER verwendet werden, um einen authentifizierten Benutzer zu ermitteln. Man könnte prüfen, ob diese Variable verwendet wird und dann entsprechend eine Warnung / Notiz ausgeben, z.B. "REMOTE_USER wird verwendet. Da safe_mode nicht mehr existiert, können auch die Variablen PHP_AUTH_USER, PHP_AUTH_PW und AUTH_TYPE verwendet werden."

Dann seh’ ich das richtig, dass wir einen Sniff brauchen der nach der Verwendung von REMOTE_USER suchen sollten und dann einfach die Warning ausgeben?

autoloading

Sehe am letzten commit, dass ihr mit require_once arbeitet, um Klassen nachzuladen.

Was haltet ihr von https://wiki.php.net/rfc/splclassloader ?

Für gelegentliches Ausführen auf der Shell bringt das zwar keinen Geschwindigkeitsvorteil, reduziert aber Code und spart etwas Zeit bei der Sniff-Erstellung.

Habe das bisher nicht geprüft, aber könnte man nicht statt eines einzelnen Sniffs das bootstrapping aufrufen und das Sniff per Klassennamen angeben.

Also etwas wie:
phpcs --standard=PHP53to54 --sniff=PHP53to54.Generic.ForbiddenConstantNames <source-path>

In eurem Beispiel muss man ja den kompletten Pfad angeben, was aber durch das RuleSet gar nicht nötig ist.

short_open_tag always enabled

Short Open Tags (short_open_tag) sind jetzt default mässig immer erlaubt. Die INI-Option dafür ist damit hinfällig. Ich hab short_open_tag jetzt in die nicht mehr erlaubten INI-Direktiven hinzugefügt. Muss man noch was prüfen – XML Dateien im Source die mit short open tag sind oder sowas?

Generic: FunctionCallSniff

Wie in #37 schon erwähnt, brauchen wir einen generischen Sniff den man über das ruleset.xml konfigurieren kann und der nach Aufrufen von Funktionen ruft und eine Fehlermeldung ausgibt. Dieser Sniff kann auch gleich den Namespace des Aufrufs mitchecken.

New Global Constants

There is a wide list of new global constants in PHP 5.4. Therefore all these constants must be checked if they are already used in the source.

    // PHP Core:
    ENT_DISALLOWED
    ENT_HTML401
    ENT_HTML5
    ENT_SUBSTITUTE
    ENT_XML1
    ENT_XHTML
    IPPROTO_IP
    IPPROTO_IPV6
    IPV6_MULTICAST_HOPS
    IPV6_MULTICAST_IF
    IPV6_MULTICAST_LOOP
    IP_MULTICAST_IF
    IP_MULTICAST_LOOP
    IP_MULTICAST_TTL
    MCAST_JOIN_GROUP
    MCAST_LEAVE_GROUP
    MCAST_BLOCK_SOURCE
    MCAST_UNBLOCK_SOURCE
    MCAST_JOIN_SOURCE_GROUP
    MCAST_LEAVE_SOURCE_GROUP

    // Curl:
    CURLOPT_MAX_RECV_SPEED_LARGE
    CURLOPT_MAX_SEND_SPEED_LARGE
    LibXML:
    LIBXML_HTML_NODEFDTD
    LIBXML_HTML_NOIMPLIED
    LIBXML_PEDANTIC

    // OpenSSL:
    OPENSSL_CIPHER_AES_128_CBC
    OPENSSL_CIPHER_AES_192_CBC
    OPENSSL_CIPHER_AES_256_CBC
    OPENSSL_RAW_DATA
    OPENSSL_ZERO_PADDING

    // Output buffering:
    PHP_OUTPUT_HANDLER_CLEAN
    PHP_OUTPUT_HANDLER_CLEANABLE
    PHP_OUTPUT_HANDLER_DISABLED
    PHP_OUTPUT_HANDLER_FINAL
    PHP_OUTPUT_HANDLER_FLUSH
    PHP_OUTPUT_HANDLER_FLUSHABLE
    PHP_OUTPUT_HANDLER_REMOVABLE
    PHP_OUTPUT_HANDLER_STARTED
    PHP_OUTPUT_HANDLER_STDFLAGS
    PHP_OUTPUT_HANDLER_WRITE

    // Sessions:
    PHP_SESSION_ACTIVE
    PHP_SESSION_DISABLED
    PHP_SESSION_NONE

    // Streams:
    STREAM_META_ACCESS
    STREAM_META_GROUP
    STREAM_META_GROUP_NAME
    STREAM_META_OWNER
    STREAM_META_OWNER_NAME
    STREAM_META_TOUCH

    // Zlib:
    ZLIB_ENCODING_DEFLATE
    ZLIB_ENCODING_GZIP
    ZLIB_ENCODING_RAW

    // Intl:
    U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR
    IDNA_CHECK_BIDI
    IDNA_CHECK_CONTEXTJ
    IDNA_NONTRANSITIONAL_TO_ASCII
    IDNA_NONTRANSITIONAL_TO_UNICODE
    INTL_IDNA_VARIANT_2003
    INTL_IDNA_VARIANT_UTS46
    IDNA_ERROR_EMPTY_LABEL
    IDNA_ERROR_LABEL_TOO_LONG
    IDNA_ERROR_DOMAIN_NAME_TOO_LONG
    IDNA_ERROR_LEADING_HYPHEN
    IDNA_ERROR_TRAILING_HYPHEN
    IDNA_ERROR_HYPHEN_3_4
    IDNA_ERROR_LEADING_COMBINING_MARK
    IDNA_ERROR_DISALLOWED
    IDNA_ERROR_PUNYCODE
    IDNA_ERROR_LABEL_HAS_DOT
    IDNA_ERROR_INVALID_ACE_LABEL
    IDNA_ERROR_BIDI
    IDNA_ERROR_CONTEXTJ

    // Json:
    JSON_PRETTY_PRINT
    JSON_UNESCAPED_SLASHES
    JSON_NUMERIC_CHECK
    JSON_UNESCAPED_UNICODE
    JSON_BIGINT_AS_STRING

New Functions

There is a list of new functions that should not exist in the global namespace of the sniffed application.

    // PHP Core
    hex2bin()
    http_response_code()
    get_declared_traits()
    getimagesizefromstring()
    stream_set_chunk_size()
    socket_import_stream()
    trait_exists()
    header_register_callback()

    //SPL
    class_uses()

    // Session
    session_status()
    session_register_shutdown()

    // Mysqli
    mysqli_error_list()
    mysqli_stmt_error_list()

    // Libxml
    libxml_set_external_entity_loader()

    // LDAP
    ldap_control_paged_result()
    ldap_control_paged_result_response()

    // Intl
    transliterator_create()
    transliterator_create_from_rules()
    transliterator_create_inverse()
    transliterator_get_error_code()
    transliterator_get_error_message()
    transliterator_list_ids()
    transliterator_transliterate()

    // Zlib
    zlib_decode()
    zlib_encode()

Generic: ForbiddenClassNames

Das selbe wie bei den anderen generischen Sniffs nur dass dieser nach nicht mehr erlaubten Klassennamen sucht - also nach Definitionen solcher Klassen.

INI-File Directives Removed

In PHP 5.4 wurden jede Menge INI Direktiven entfernt. Manche konnte man über php_ini_set setzten (PHP_INI_ALL, PHP_INI_USER). Genau solche Aufrufe muss dieser Sniff finden. Die anderen INI Settings kann man nur in php.ini, .htaccess oder httpd.conf ändern und diese sind dann eher ein Fall für die #28 (Parsing .conf / .ini files).

List of Modes:

  • PHP_INI_USER
    Eintrag kann in Benutzerskripten (z.B. mittels ini_set()) oder in der Windows-Registry gesetzt werden
  • PHP_INI_PERDIR
    Eintrag kann in der php.ini, .htaccess oder httpd.conf gesetzt werden
  • PHP_INI_SYSTEM
    Eintrag kann in der php.ini oder httpd.conf gesetzt werden
  • PHP_INI_ALL
    Eintrag kann überall gesetzt werden

The following php.ini directives have been removed:

register_globals        // PHP_INI_PERDIR
register_long_arrays    // PHP_INI_PERDIR
magic_quotes_gpc        // PHP_INI_PERDIR
magic_quotes_runtime    // PHP_INI_ALL
magic_quotes_sybase     // PHP_INI_ALL
allow_call_time_pass_reference      // PHP_INI_PERDIR
define_syslog_variables // PHP_INI_ALL
highlight.bg            // PHP_INI_ALL
session.bug_compat_42   // PHP_INI_ALL
session.bug_compat_warn // PHP_INI_ALL
y2k_compliance          // PHP_INI_ALL

safe_mode               // PHP_INI_SYSTEM
safe_mode_gid           // PHP_INI_SYSTEM
safe_mode_include_dir   // PHP_INI_SYSTEM
safe_mode_exec_dir      // PHP_INI_SYSTEM
safe_mode_allowed_env_vars // PHP_INI_SYSTEM 
safe_mode_protected_env_vars // PHP_INI_SYSTEM

Die relavanten INI-Direktiven sind dann:

magic_quotes_runtime    // PHP_INI_ALL
magic_quotes_sybase     // PHP_INI_ALL
define_syslog_variables // PHP_INI_ALL
highlight.bg            // PHP_INI_ALL
session.bug_compat_42   // PHP_INI_ALL
session.bug_compat_warn // PHP_INI_ALL
y2k_compliance          // PHP_INI_ALL

Generic: ForbiddenInterfaceNames

Wie für die anderen generischen Sniffs wäre es super wenn man eine generische Sniff Klasse hätte die man über XML einstellen kann die nach nicht mehr erlaubten interfacenamen sucht.

E_ALL includes E_STRICT

E_ALL now includes E_STRICT level errors in the error_reporting configuration directive.

Einfach im Source nach

<?php
error_reporting(E_ALL | E_STRICT);

suchen lassen und eine warning ausgeben. Das ist ja nicht mehr nötig.

Parsing .conf / .ini files

Es ist so:

Wenn man explizit angibt, dass man eine einzelne phpcs targetfile.conf oder mehrere phpcs targetdir/*.conf mit PHP_CodeSniffer durchlaufen lassen will geht das. Wenn man PHP_CodeSniffer einfach so aufruft ohne direkte Angabe von Dateiendungen oder ähnlichem ignoriert er allerdings .conf oder .ini Dateien.

Forbidden Function schlägt fehl

mit dem symfony source schlägt aktuell der ForbiddenFunktionNamesSniff.php fehl obwohl es eigentlich in Ordnung ist wie es angewende wird.

Das Beispiel:

<?php
 // line ~87
            // src/Symfony/Component/ClassLoader::class ClassCollectionLoader
foreach ($classes as $class) {
            if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) {
                throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
            }foreach ($classes as $class) {
            if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) {
                throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
            }

Namespace detection

It should be possible to detect the namespace of a file / class. If detected, then all definitions (class, functions, constants, interfaces) should be checked against global namespace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.