SlideShare a Scribd company logo
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y
C H E C K I N G U S I N G P H P 7 C C
( A N D P H P C O M PAT I B I L I T Y )
M A R K N I E B E R G A L L
https://joind.in/talk/6e322

https://github.com/mbniebergall/php7-incompatible
A B O U T M A R K N I E B E R G A L L
• PHP since 2005
• Masters degree in MIS
• Senior Software Engineer
• Drug screening project
• President of Utah PHP User Group (UPHPU)
• SSCP, CSSLP Certified and SME for (ISC)2
• Drones, fishing, skiing, father, husband
A B O U T M A R K N I E B E R G A L L
• Manchester
• Nelson
• Workington
A B O U T M A R K N I E B E R G A L L
A B O U T M A R K N I E B E R G A L L
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y
C H E C K I N G U S I N G P H P 7 C C
( A N D P H P C O M PAT I B I L I T Y )
https://www.besttoolsblog.com/top-17-for-best-pex-crimp-tool/
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G
U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y )
• Objectives
- Understand why upgrading to PHP 7 is important
- Know how to use automated tools to help
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G
U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y )
• https://joind.in/talk/6e322
• https://github.com/mbniebergall/php7-incompatible
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G
U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y )
• Big projects originating with PHP 4
• Hundreds of thousands of lines of code
• Path to upgrading to PHP 7
A U T O M AT I C P H P 7 C O M PAT I B I L I T Y
C H E C K I N G U S I N G P H P 7 C C
• Overview
- Why upgrade to PHP 7
- Introduction to php7cc
- Using php7cc
- Introduction to PHPCompatibility
- Using PHPCompatibility
- Common issues
- Live examples
- Analysis
- Considerations
W H Y U P G R A D E T O P H P 7
W H Y U P G R A D E T O P H P 7
• Incompatibilities to watch for
• Automated tools can help
W H Y U P G R A D E T O P H P 7
• Performance
- 2-3x faster than PH P 5.6
- 30-50% better memory consumption than PHP 5.6
- More requests per second
W H Y U P G R A D E T O P H P 7
• Security
- CSPRNG random_bytes and random_int
- libsodium in PHP 7.2
- mcrypt deprecated in PHP 7.1
- password_hash salt option deprecated
- password_hash Argon2 hash available in PHP 7.2
W H Y U P G R A D E T O P H P 7
• New features
- Scalar type declarations
- public function thing(int $int)
- Return type declarations
- public function thing(int $int) : Something
W H Y U P G R A D E T O P H P 7
• New features
- Reserved class names for types
- Int
- String
- Float
- Bool
- NULL
- TRUE
- FALSE
W H Y U P G R A D E T O P H P 7
• New features
- Null coalescing operator
- $thing = $widget ?? $other;
- Spaceship operator
- $this <=> $that
W H Y U P G R A D E T O P H P 7
• New features
- Anonymous classes
- Generator return expressions
- Exceptions instead of failures
- Many more great features
W H Y U P G R A D E T O P H P 7
• Deprecated features
- #1 PHP 4 style constructors
- class Thing {

public function Thing() {}

}
W H Y U P G R A D E T O P H P 7
• Removed
- #2 $HTTP_RAW_POST_DATA
- $GLOBALS[‘HTTP_RAW_POST_DATA']
W H Y U P G R A D E T O P H P 7
• Deprecated features
- #3 Static calls to non-static methods
- class Thing {

public function doSomething() {…}

public static function doOther() {…}

}

Thing::doSomething();

$thing = new Thing;

$thing->doOther();
W H Y U P G R A D E T O P H P 7
• Removed
- call_user_method and call_user_method_array
- ereg*
- mysql*
- mssql*
- set_magic_quotes_runtime
- set_socket_blocking
W H Y U P G R A D E T O P H P 7
• Removed
- <% %>
- <%= %>
- <script language=“php”> </script>
W H Y U P G R A D E T O P H P 7
• Tools
- XDebug no longer supports PHP 5
- Most libraries focused on PHP 7.0+
I N T R O D U C T I O N T O
P H P 7 C C
P H P 7 C C
• PHP 7 Compatibility Checker
- sstalle on GitHub
- Stand-alone library
- Available using composer
P H P 7 C C
• PHP 7 Compatibility Checker
- Static code analysis
- Upgrading from PHP 5.3-5.6 to PHP 7.0
- Identifies issues
- Does not automatically fix the issues
- php.net has recommended fixes
P H P 7 C C
• PHP 7 Compatibility Checker
- composer require sstalle/php7cc --dev
- ./vendor/bin/php7cc src/
- composer global require sstalle/php7cc
- export PATH="$PATH:$HOME/.config/composer/
vendor/bin"
- php7cc src/
P H P 7 C C
• PHP 7 Compatibility Checker
- php7cc /project/path/
- php7cc /project/path/File.php
U S I N G P H P 7 C C
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -h --help
- Help information
- php7cc -h
- php7cc --help
P H P 7 C C
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -e --extensions
- File extension
- Defaults to php
- php7cc -e phps src/
- php7cc --extensions “phps,php” src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -x --except
- Exclude files or directories
- php7cc -x src/Deprecated.php src/
- php7cc --except=vendor/ src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -l --level
- Level and higher to display
- Defaults to info
- info, message, warning, or error
- php7cc -l warning src/
- php7cc --level=error src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -r --relative-paths
- php7cc -r src/
- php7cc --relative-paths src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: --integer-size
- Used for bitwise shift check
- Defaults to 32
- php7cc --integer-size=8 src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -o --output-format
- Output format
- Defaults to plain
- plain or json
- php7cc -o json src/
- php7cc --output-format=json src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -q --quiet
- Run without output
- php7cc -q src/
- php7cc --quiet src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -V --version
- Version of php7cc
- php7cc -V
- php7cc --version
- PHP 7 Compatibility Checker 1.2.1
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: --ansi
- Force ANSI output on
- Pretty terminal colors
- php7cc --no-ansi src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: --no-ansi
- Turn off ANSI output
- No colors
- php7cc --no-ansi src/
P H P 7 C C
• PHP 7 Compatibility Checker
- Option: -v -vv -vvv --verbose
- Verbose level
- Defaults to 1
- php7cc -vvv phps src/
- php7cc --verbose=2 src/
I N T R O D U C T I O N T O
P H P C O M PAT I B I L I T Y
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Wim Godden, Juliette, and others
- Sniff for PHP Code Sniffer (phpcs)
- Static code analysis
- Upgrading from PHP 5.1-5.6 to PHP 7.2
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- composer require --dev wimg/php-compatibility
- composer require --dev squizlabs/php_codesniffer
- composer require --dev dealerdirect/
phpcodesniffer-composer-installer
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- If only 1 sniff
- phpcs --config-set installed_paths vendor/wimg/
php-compatibility/PHPCompatibility
- Check with
- phpcs --config-show
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- ./vendor/bin/phpcs --standard=PHPCompatibility
src/
- If bin is not in PATH
- phpcs --standard=PHPCompatibility src/
- Run just PHP 7 compatibility sniff
- phpcs src/
- Run all sniffs
U S I N G
P H P C O M PAT I B I L I T Y
P H P C O M PAT I B I L I T Y
• phpcs --help
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -n --warning-severity=0
- Turn off warnings, just see errors
- phpcs --standard=PHPCompatibility -n src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -w
- Show errors and warnings
- This is the default
- phpcs --standard=PHPCompatibility -w src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -l
- Local directory only
- Do not go recursively through subdirectories
- phpcs --standard=PHPCompatibility -l src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -s
- Show sniff codes
- phpcs --standard=PHPCompatibility -s src/
- (PHPCompatibility.PHP.ForbiddenNamesAsDecl
ared.intFound)
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -a
- Interactive mode
- phpcs --standard=PHPCompatibility -a src/
SwitchMultiDefault
- <ENTER> to recheck, [s] to skip or [q] to quit :
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -e
- Explain a coding standard
- phpcs --standard=PHPCompatibility -e src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -p
- Show scan progress
- phpcs --standard=PHPCompatibility -p src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -q
- Quiet mode
- Disables progress and verbose output
- phpcs --standard=PHPCompatibility -q src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -m
- Stop error messages from being recorded
- (saves a lot of memory, but stops many reports
from being used)
- Can be useful for very large projects
- phpcs --standard=PHPCompatibility -m src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -v
- List files processed
- phpcs --standard=PHPCompatibility -v src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -vv
- Print rulesets from tokens recorded
- Debugging mode
- phpcs --standard=PHPCompatibility -vv src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -vvv
- Print rulesets from tokens recorded with
processing information
- Debugging mode with timing
- phpcs --standard=PHPCompatibility -vvv src/
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -i
- Installed sniffs
- phpcs --standard=PHPCompatibility -i
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Option: -d
- php.ini directives
- phpcs --standard=PHPCompatibility src/ -d
memory_limt=1024M
P H P C O M PAT I B I L I T Y
• PHPCompatibility
- Other options available
- Not going to cover them all
C O M M O N I S S U E S
C O M M O N I S S U E S
• error_reporting level
- E_ALL
C O M M O N I S S U E S
• Static code analysis does not cover everything
C O M M O N I S S U E S
• Unit and functional tests
- Lack of tests with legacy applications
C O M M O N I S S U E S
• Ignore directories or files
- vendor
- php7cc infinite loop error
- Backwards compatible code
A N A LY S I S
A N A LY S I S
• https://github.com/mbniebergall/php7-incompatible
• PHP 5.6 to PHP 7.2
• 49 PHP files
A N A LY S I S
• Incompatibilities
- http://php.net/manual/en/
migration70.incompatible.php
• Deprecated
- http://php.net/manual/en/
migration70.deprecated.php
A N A LY S I S
P H P C S
E R R O R S
P H P C S
WA R N I N G S
P H P 7 C C
E R R O R S
P H P 7 C C
WA R N I N G S
T O TA L 3 3 4 3 0 6
C O U N T 2 3 3 2 7 5
U N I Q U E 4 2 2 4
A N A LY S I S
Totals
php7cc-warning
9%
php7cc-error
47%
phpcs-warning
5%
phpcs-error
40%
A N A LY S I S Table 1
File phpcs-error phpcs-warning php7cc-error php7cc-warning
ArrayOrder.php 0 0 0 1
BitwiseShift.php 1 0 1 0
CallUserMethod.php 2 0 2 0
Constructor.php 0 1 1 0
DateFormatting.php 1 0 1 0
DivideByZero.php 0 0 2 0
DuplicateParameter.php 1 0 1 0
EregRemoved.php 4 0 2 0
EvalIsEvil.php 0 0 0 0
ExceptionHandler.php 0 0 0 0
ExtraParens.php 0 0 0 0
ForeachPointer.php 0 0 0 0
FuncGetArg.php 0 0 0 2
Globals.php 1 0 1 0
HexadecimalStrings.php 1 0 0 1
A N A LY S I S Table 1
File phpcs-error phpcs-warning php7cc-error php7cc-warning
HttpRawPostData.php 1 0 2 0
ImagePostScript.php 1 0 1 0
Int.php 1 0 1 0
InvalidOctal.php 1 0 1 0
JsonToJsonD.php 0 0 0 0
LdapDeprecated.php 0 1 0 0
McryptDecprecated.php 1 0 0 0
Mssql.php 3 0 3 0
Mysql.php 3 0 3 0
ObjectByReference.php 1 0 1 0
PasswordHashSalt.php 0 0 1 0
SetMagicQuotes.php 1 0 1 0
SetStreamBlocking.php 1 0 1 0
ShortTags.php 0 2 0 0
Split.php 1 0 1 0
A N A LY S I S Table 1
File phpcs-error phpcs-warning php7cc-error php7cc-warning
StaticCalls.php 0 0 0 0
SwitchMultiDefault.php 1 0 1 0
YieldParenthesis.php 0 0 0 1
php7-1/ArrayOrdering.php 0 0 0 1
php7-1/ClosureBoundVariable.php 3 0 0 0
php7-1/DynamicCalls.php 0 0 1 0
php7-1/Iterable.php 1 0 0 0
php7-1/JsonDecodeEmpty.php 0 0 0 0
php7-1/LongToIp.php 0 0 0 0
php7-1/RandAliasMtRand.php 0 0 0 0
php7-1/StringArray.php 0 0 0 0
php7-1/TooFewArguments.php 0 0 0 0
php7-1/Void.php 1 0 0 0
php7-2/CountNonCountables.php 0 0 0 0
php7-2/GetClassNull.php 0 0 0 0
A N A LY S I S Table 1
File phpcs-error phpcs-warning php7cc-error php7cc-warning
php7-2/HashInitNotResource.php 0 0 0 0
php7-2/NumberFormatNegativeZero.php 0 0 0 0
php7-2/Object.php 1 0 1 0
php7-2/UndefinedConstants.php 0 0 0 0
TOTAL 33 4 30 6
COUNT 23 3 27 5
A N A LY S I S
• Timing on 2364 files
- php7cc - 276.595 seconds
- PHPCompatibility - 271.26 seconds
A N A LY S I S
• Frameworks
Table 1
phpcs time phpcs issues php7cc time php7cc issues File Count
Zend 35.27 330 ERROR ERROR 2364
Symfony 171.41 34 144.611 133 3740
Slim 1.93 0 1.642 1 46
Wordpress 188.65 302 123.979 177 1280
Laravel 31.13 36 22.478 83 878
L I V E E X A M P L E S
Q U E S T I O N S ?
https://joind.in/talk/6e322
R E S O U R C E S
• http://www.zend.com/en/resources/php7_infographic
• https://github.com/sstalle/php7cc
• https://github.com/wimg/PHPCompatibility
Ad

Recommended

Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018
Mark Niebergall
 
Stacking Up Middleware
Stacking Up Middleware
Mark Niebergall
 
Php 7 hhvm and co
Php 7 hhvm and co
Pierre Joye
 
Php7 hhvm and co
Php7 hhvm and co
Pierre Joye
 
Debugging concurrency programs in go
Debugging concurrency programs in go
Andrii Soldatenko
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4
Wim Godden
 
PHP 7.1 : elegance of our legacy
PHP 7.1 : elegance of our legacy
Damien Seguy
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPAN
charsbar
 
Preparing code for Php 7 workshop
Preparing code for Php 7 workshop
Damien Seguy
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
Alessandro Franceschi
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
Andrii Soldatenko
 
Effective Benchmarks
Effective Benchmarks
Workhorse Computing
 
Nginx pres
Nginx pres
James Fuller
 
How to inspect a RUNNING perl process
How to inspect a RUNNING perl process
Masaaki HIROSE
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
Wim Godden
 
Unit Testing Lots of Perl
Unit Testing Lots of Perl
Workhorse Computing
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
James Fuller
 
How to deploy node to production
How to deploy node to production
Sean Hess
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
Wim Godden
 
Getting Testy With Perl6
Getting Testy With Perl6
Workhorse Computing
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
Wim Godden
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
LiviaLiaoFontech
 
Get your teeth into Plack
Get your teeth into Plack
Workhorse Computing
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?
Wim Godden
 
Smoking docker
Smoking docker
Workhorse Computing
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
Combell NV
 
Php through the eyes of a hoster
Php through the eyes of a hoster
Combell NV
 

More Related Content

What's hot (20)

Preparing code for Php 7 workshop
Preparing code for Php 7 workshop
Damien Seguy
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
Alessandro Franceschi
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
Andrii Soldatenko
 
Effective Benchmarks
Effective Benchmarks
Workhorse Computing
 
Nginx pres
Nginx pres
James Fuller
 
How to inspect a RUNNING perl process
How to inspect a RUNNING perl process
Masaaki HIROSE
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
Wim Godden
 
Unit Testing Lots of Perl
Unit Testing Lots of Perl
Workhorse Computing
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
James Fuller
 
How to deploy node to production
How to deploy node to production
Sean Hess
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
Wim Godden
 
Getting Testy With Perl6
Getting Testy With Perl6
Workhorse Computing
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
Wim Godden
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
LiviaLiaoFontech
 
Get your teeth into Plack
Get your teeth into Plack
Workhorse Computing
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?
Wim Godden
 
Smoking docker
Smoking docker
Workhorse Computing
 
Preparing code for Php 7 workshop
Preparing code for Php 7 workshop
Damien Seguy
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
Alessandro Franceschi
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
Andrii Soldatenko
 
How to inspect a RUNNING perl process
How to inspect a RUNNING perl process
Masaaki HIROSE
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
James Titcumb
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
Wim Godden
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
James Fuller
 
How to deploy node to production
How to deploy node to production
Sean Hess
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
Wim Godden
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
Wim Godden
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
LiviaLiaoFontech
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?
Wim Godden
 

Similar to Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility) (20)

Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
Combell NV
 
Php through the eyes of a hoster
Php through the eyes of a hoster
Combell NV
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
PHPBelgium
 
Static analysis saved my code tonight
Static analysis saved my code tonight
Damien Seguy
 
PHP QA Tools
PHP QA Tools
rjsmelo
 
20 PHP Static Analysis and Documentation Generators #burningkeyboards
20 PHP Static Analysis and Documentation Generators #burningkeyboards
Denis Ristic
 
Continuous Quality Assurance
Continuous Quality Assurance
Michelangelo van Dam
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
Combell NV
 
PHP Development Tools
PHP Development Tools
Antony Abramchenko
 
php & performance
php & performance
simon8410
 
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Dana Luther
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHP
Jonathan Klein
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themes
Otto Kekäläinen
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
Orange Tsai
 
Orange@php conf
Orange@php conf
Hash Lin
 
PHP MySQL Training : Module 2
PHP MySQL Training : Module 2
hussulinux
 
PHP & Performance
PHP & Performance
毅 吕
 
Keynote: O PHP, Where Art Thou?
Keynote: O PHP, Where Art Thou?
DeveloperConference
 
Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016
Eric Poe
 
Standards: Don't pee in the pool
Standards: Don't pee in the pool
David Yell
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
Combell NV
 
Php through the eyes of a hoster
Php through the eyes of a hoster
Combell NV
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
PHPBelgium
 
Static analysis saved my code tonight
Static analysis saved my code tonight
Damien Seguy
 
PHP QA Tools
PHP QA Tools
rjsmelo
 
20 PHP Static Analysis and Documentation Generators #burningkeyboards
20 PHP Static Analysis and Documentation Generators #burningkeyboards
Denis Ristic
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
Combell NV
 
php & performance
php & performance
simon8410
 
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Dana Luther
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHP
Jonathan Klein
 
Automatic testing and quality assurance for WordPress plugins and themes
Automatic testing and quality assurance for WordPress plugins and themes
Otto Kekäläinen
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
Orange Tsai
 
Orange@php conf
Orange@php conf
Hash Lin
 
PHP MySQL Training : Module 2
PHP MySQL Training : Module 2
hussulinux
 
PHP & Performance
PHP & Performance
毅 吕
 
Last 2 Months in PHP - July & August 2016
Last 2 Months in PHP - July & August 2016
Eric Poe
 
Standards: Don't pee in the pool
Standards: Don't pee in the pool
David Yell
 
Ad

More from Mark Niebergall (20)

Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023
Mark Niebergall
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023
Mark Niebergall
 
Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023
Mark Niebergall
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022
Mark Niebergall
 
Developing SOLID Code
Developing SOLID Code
Mark Niebergall
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to Deployment
Mark Niebergall
 
BDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and Behat
Mark Niebergall
 
BDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and Behat
Mark Niebergall
 
Hacking with PHP
Hacking with PHP
Mark Niebergall
 
Relational Database Design Bootcamp
Relational Database Design Bootcamp
Mark Niebergall
 
Starting Out With PHP
Starting Out With PHP
Mark Niebergall
 
Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018
Mark Niebergall
 
Defensive Coding Crash Course Tutorial
Defensive Coding Crash Course Tutorial
Mark Niebergall
 
Inheritance: Vertical or Horizontal
Inheritance: Vertical or Horizontal
Mark Niebergall
 
Cybersecurity State of the Union
Cybersecurity State of the Union
Mark Niebergall
 
Cryptography With PHP - ZendCon 2017 Workshop
Cryptography With PHP - ZendCon 2017 Workshop
Mark Niebergall
 
Defensive Coding Crash Course - ZendCon 2017
Defensive Coding Crash Course - ZendCon 2017
Mark Niebergall
 
Leveraging Composer in Existing Projects
Leveraging Composer in Existing Projects
Mark Niebergall
 
Defensive Coding Crash Course
Defensive Coding Crash Course
Mark Niebergall
 
Impostor Syndrome: Be Proud of Your Achievements!
Impostor Syndrome: Be Proud of Your Achievements!
Mark Niebergall
 
Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023
Mark Niebergall
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023
Mark Niebergall
 
Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023
Mark Niebergall
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022
Mark Niebergall
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to Deployment
Mark Niebergall
 
BDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and Behat
Mark Niebergall
 
BDD API Tests with Gherkin and Behat
BDD API Tests with Gherkin and Behat
Mark Niebergall
 
Relational Database Design Bootcamp
Relational Database Design Bootcamp
Mark Niebergall
 
Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018
Mark Niebergall
 
Defensive Coding Crash Course Tutorial
Defensive Coding Crash Course Tutorial
Mark Niebergall
 
Inheritance: Vertical or Horizontal
Inheritance: Vertical or Horizontal
Mark Niebergall
 
Cybersecurity State of the Union
Cybersecurity State of the Union
Mark Niebergall
 
Cryptography With PHP - ZendCon 2017 Workshop
Cryptography With PHP - ZendCon 2017 Workshop
Mark Niebergall
 
Defensive Coding Crash Course - ZendCon 2017
Defensive Coding Crash Course - ZendCon 2017
Mark Niebergall
 
Leveraging Composer in Existing Projects
Leveraging Composer in Existing Projects
Mark Niebergall
 
Defensive Coding Crash Course
Defensive Coding Crash Course
Mark Niebergall
 
Impostor Syndrome: Be Proud of Your Achievements!
Impostor Syndrome: Be Proud of Your Achievements!
Mark Niebergall
 
Ad

Recently uploaded (20)

Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
Artificial Intelligence Workloads and Data Center Management
Artificial Intelligence Workloads and Data Center Management
SandeepKS52
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
Artificial Intelligence Workloads and Data Center Management
Artificial Intelligence Workloads and Data Center Management
SandeepKS52
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 

Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)

  • 1. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y ) M A R K N I E B E R G A L L https://joind.in/talk/6e322
 https://github.com/mbniebergall/php7-incompatible
  • 2. A B O U T M A R K N I E B E R G A L L • PHP since 2005 • Masters degree in MIS • Senior Software Engineer • Drug screening project • President of Utah PHP User Group (UPHPU) • SSCP, CSSLP Certified and SME for (ISC)2 • Drones, fishing, skiing, father, husband
  • 3. A B O U T M A R K N I E B E R G A L L • Manchester • Nelson • Workington
  • 4. A B O U T M A R K N I E B E R G A L L
  • 5. A B O U T M A R K N I E B E R G A L L
  • 6. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y )
  • 8. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y ) • Objectives - Understand why upgrading to PHP 7 is important - Know how to use automated tools to help
  • 9. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y ) • https://joind.in/talk/6e322 • https://github.com/mbniebergall/php7-incompatible
  • 10. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C ( A N D P H P C O M PAT I B I L I T Y ) • Big projects originating with PHP 4 • Hundreds of thousands of lines of code • Path to upgrading to PHP 7
  • 11. A U T O M AT I C P H P 7 C O M PAT I B I L I T Y C H E C K I N G U S I N G P H P 7 C C • Overview - Why upgrade to PHP 7 - Introduction to php7cc - Using php7cc - Introduction to PHPCompatibility - Using PHPCompatibility - Common issues - Live examples - Analysis - Considerations
  • 12. W H Y U P G R A D E T O P H P 7
  • 13. W H Y U P G R A D E T O P H P 7 • Incompatibilities to watch for • Automated tools can help
  • 14. W H Y U P G R A D E T O P H P 7 • Performance - 2-3x faster than PH P 5.6 - 30-50% better memory consumption than PHP 5.6 - More requests per second
  • 15. W H Y U P G R A D E T O P H P 7 • Security - CSPRNG random_bytes and random_int - libsodium in PHP 7.2 - mcrypt deprecated in PHP 7.1 - password_hash salt option deprecated - password_hash Argon2 hash available in PHP 7.2
  • 16. W H Y U P G R A D E T O P H P 7 • New features - Scalar type declarations - public function thing(int $int) - Return type declarations - public function thing(int $int) : Something
  • 17. W H Y U P G R A D E T O P H P 7 • New features - Reserved class names for types - Int - String - Float - Bool - NULL - TRUE - FALSE
  • 18. W H Y U P G R A D E T O P H P 7 • New features - Null coalescing operator - $thing = $widget ?? $other; - Spaceship operator - $this <=> $that
  • 19. W H Y U P G R A D E T O P H P 7 • New features - Anonymous classes - Generator return expressions - Exceptions instead of failures - Many more great features
  • 20. W H Y U P G R A D E T O P H P 7 • Deprecated features - #1 PHP 4 style constructors - class Thing {
 public function Thing() {}
 }
  • 21. W H Y U P G R A D E T O P H P 7 • Removed - #2 $HTTP_RAW_POST_DATA - $GLOBALS[‘HTTP_RAW_POST_DATA']
  • 22. W H Y U P G R A D E T O P H P 7 • Deprecated features - #3 Static calls to non-static methods - class Thing {
 public function doSomething() {…}
 public static function doOther() {…}
 }
 Thing::doSomething();
 $thing = new Thing;
 $thing->doOther();
  • 23. W H Y U P G R A D E T O P H P 7 • Removed - call_user_method and call_user_method_array - ereg* - mysql* - mssql* - set_magic_quotes_runtime - set_socket_blocking
  • 24. W H Y U P G R A D E T O P H P 7 • Removed - <% %> - <%= %> - <script language=“php”> </script>
  • 25. W H Y U P G R A D E T O P H P 7 • Tools - XDebug no longer supports PHP 5 - Most libraries focused on PHP 7.0+
  • 26. I N T R O D U C T I O N T O P H P 7 C C
  • 27. P H P 7 C C • PHP 7 Compatibility Checker - sstalle on GitHub - Stand-alone library - Available using composer
  • 28. P H P 7 C C • PHP 7 Compatibility Checker - Static code analysis - Upgrading from PHP 5.3-5.6 to PHP 7.0 - Identifies issues - Does not automatically fix the issues - php.net has recommended fixes
  • 29. P H P 7 C C • PHP 7 Compatibility Checker - composer require sstalle/php7cc --dev - ./vendor/bin/php7cc src/ - composer global require sstalle/php7cc - export PATH="$PATH:$HOME/.config/composer/ vendor/bin" - php7cc src/
  • 30. P H P 7 C C • PHP 7 Compatibility Checker - php7cc /project/path/ - php7cc /project/path/File.php
  • 31. U S I N G P H P 7 C C
  • 32. P H P 7 C C • PHP 7 Compatibility Checker - Option: -h --help - Help information - php7cc -h - php7cc --help
  • 33. P H P 7 C C
  • 34. P H P 7 C C • PHP 7 Compatibility Checker - Option: -e --extensions - File extension - Defaults to php - php7cc -e phps src/ - php7cc --extensions “phps,php” src/
  • 35. P H P 7 C C • PHP 7 Compatibility Checker - Option: -x --except - Exclude files or directories - php7cc -x src/Deprecated.php src/ - php7cc --except=vendor/ src/
  • 36. P H P 7 C C • PHP 7 Compatibility Checker - Option: -l --level - Level and higher to display - Defaults to info - info, message, warning, or error - php7cc -l warning src/ - php7cc --level=error src/
  • 37. P H P 7 C C • PHP 7 Compatibility Checker - Option: -r --relative-paths - php7cc -r src/ - php7cc --relative-paths src/
  • 38. P H P 7 C C • PHP 7 Compatibility Checker - Option: --integer-size - Used for bitwise shift check - Defaults to 32 - php7cc --integer-size=8 src/
  • 39. P H P 7 C C • PHP 7 Compatibility Checker - Option: -o --output-format - Output format - Defaults to plain - plain or json - php7cc -o json src/ - php7cc --output-format=json src/
  • 40. P H P 7 C C • PHP 7 Compatibility Checker - Option: -q --quiet - Run without output - php7cc -q src/ - php7cc --quiet src/
  • 41. P H P 7 C C • PHP 7 Compatibility Checker - Option: -V --version - Version of php7cc - php7cc -V - php7cc --version - PHP 7 Compatibility Checker 1.2.1
  • 42. P H P 7 C C • PHP 7 Compatibility Checker - Option: --ansi - Force ANSI output on - Pretty terminal colors - php7cc --no-ansi src/
  • 43. P H P 7 C C • PHP 7 Compatibility Checker - Option: --no-ansi - Turn off ANSI output - No colors - php7cc --no-ansi src/
  • 44. P H P 7 C C • PHP 7 Compatibility Checker - Option: -v -vv -vvv --verbose - Verbose level - Defaults to 1 - php7cc -vvv phps src/ - php7cc --verbose=2 src/
  • 45. I N T R O D U C T I O N T O P H P C O M PAT I B I L I T Y
  • 46. P H P C O M PAT I B I L I T Y • PHPCompatibility - Wim Godden, Juliette, and others - Sniff for PHP Code Sniffer (phpcs) - Static code analysis - Upgrading from PHP 5.1-5.6 to PHP 7.2
  • 47. P H P C O M PAT I B I L I T Y • PHPCompatibility - composer require --dev wimg/php-compatibility - composer require --dev squizlabs/php_codesniffer - composer require --dev dealerdirect/ phpcodesniffer-composer-installer
  • 48. P H P C O M PAT I B I L I T Y • PHPCompatibility - If only 1 sniff - phpcs --config-set installed_paths vendor/wimg/ php-compatibility/PHPCompatibility - Check with - phpcs --config-show
  • 49. P H P C O M PAT I B I L I T Y • PHPCompatibility - ./vendor/bin/phpcs --standard=PHPCompatibility src/ - If bin is not in PATH - phpcs --standard=PHPCompatibility src/ - Run just PHP 7 compatibility sniff - phpcs src/ - Run all sniffs
  • 50. U S I N G P H P C O M PAT I B I L I T Y
  • 51. P H P C O M PAT I B I L I T Y • phpcs --help
  • 52. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -n --warning-severity=0 - Turn off warnings, just see errors - phpcs --standard=PHPCompatibility -n src/
  • 53. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -w - Show errors and warnings - This is the default - phpcs --standard=PHPCompatibility -w src/
  • 54. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -l - Local directory only - Do not go recursively through subdirectories - phpcs --standard=PHPCompatibility -l src/
  • 55. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -s - Show sniff codes - phpcs --standard=PHPCompatibility -s src/ - (PHPCompatibility.PHP.ForbiddenNamesAsDecl ared.intFound)
  • 56. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -a - Interactive mode - phpcs --standard=PHPCompatibility -a src/ SwitchMultiDefault - <ENTER> to recheck, [s] to skip or [q] to quit :
  • 57. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -e - Explain a coding standard - phpcs --standard=PHPCompatibility -e src/
  • 58. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -p - Show scan progress - phpcs --standard=PHPCompatibility -p src/
  • 59. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -q - Quiet mode - Disables progress and verbose output - phpcs --standard=PHPCompatibility -q src/
  • 60. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -m - Stop error messages from being recorded - (saves a lot of memory, but stops many reports from being used) - Can be useful for very large projects - phpcs --standard=PHPCompatibility -m src/
  • 61. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -v - List files processed - phpcs --standard=PHPCompatibility -v src/
  • 62. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -vv - Print rulesets from tokens recorded - Debugging mode - phpcs --standard=PHPCompatibility -vv src/
  • 63. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -vvv - Print rulesets from tokens recorded with processing information - Debugging mode with timing - phpcs --standard=PHPCompatibility -vvv src/
  • 64. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -i - Installed sniffs - phpcs --standard=PHPCompatibility -i
  • 65. P H P C O M PAT I B I L I T Y • PHPCompatibility - Option: -d - php.ini directives - phpcs --standard=PHPCompatibility src/ -d memory_limt=1024M
  • 66. P H P C O M PAT I B I L I T Y • PHPCompatibility - Other options available - Not going to cover them all
  • 67. C O M M O N I S S U E S
  • 68. C O M M O N I S S U E S • error_reporting level - E_ALL
  • 69. C O M M O N I S S U E S • Static code analysis does not cover everything
  • 70. C O M M O N I S S U E S • Unit and functional tests - Lack of tests with legacy applications
  • 71. C O M M O N I S S U E S • Ignore directories or files - vendor - php7cc infinite loop error - Backwards compatible code
  • 72. A N A LY S I S
  • 73. A N A LY S I S • https://github.com/mbniebergall/php7-incompatible • PHP 5.6 to PHP 7.2 • 49 PHP files
  • 74. A N A LY S I S • Incompatibilities - http://php.net/manual/en/ migration70.incompatible.php • Deprecated - http://php.net/manual/en/ migration70.deprecated.php
  • 75. A N A LY S I S P H P C S E R R O R S P H P C S WA R N I N G S P H P 7 C C E R R O R S P H P 7 C C WA R N I N G S T O TA L 3 3 4 3 0 6 C O U N T 2 3 3 2 7 5 U N I Q U E 4 2 2 4
  • 76. A N A LY S I S Totals php7cc-warning 9% php7cc-error 47% phpcs-warning 5% phpcs-error 40%
  • 77. A N A LY S I S Table 1 File phpcs-error phpcs-warning php7cc-error php7cc-warning ArrayOrder.php 0 0 0 1 BitwiseShift.php 1 0 1 0 CallUserMethod.php 2 0 2 0 Constructor.php 0 1 1 0 DateFormatting.php 1 0 1 0 DivideByZero.php 0 0 2 0 DuplicateParameter.php 1 0 1 0 EregRemoved.php 4 0 2 0 EvalIsEvil.php 0 0 0 0 ExceptionHandler.php 0 0 0 0 ExtraParens.php 0 0 0 0 ForeachPointer.php 0 0 0 0 FuncGetArg.php 0 0 0 2 Globals.php 1 0 1 0 HexadecimalStrings.php 1 0 0 1
  • 78. A N A LY S I S Table 1 File phpcs-error phpcs-warning php7cc-error php7cc-warning HttpRawPostData.php 1 0 2 0 ImagePostScript.php 1 0 1 0 Int.php 1 0 1 0 InvalidOctal.php 1 0 1 0 JsonToJsonD.php 0 0 0 0 LdapDeprecated.php 0 1 0 0 McryptDecprecated.php 1 0 0 0 Mssql.php 3 0 3 0 Mysql.php 3 0 3 0 ObjectByReference.php 1 0 1 0 PasswordHashSalt.php 0 0 1 0 SetMagicQuotes.php 1 0 1 0 SetStreamBlocking.php 1 0 1 0 ShortTags.php 0 2 0 0 Split.php 1 0 1 0
  • 79. A N A LY S I S Table 1 File phpcs-error phpcs-warning php7cc-error php7cc-warning StaticCalls.php 0 0 0 0 SwitchMultiDefault.php 1 0 1 0 YieldParenthesis.php 0 0 0 1 php7-1/ArrayOrdering.php 0 0 0 1 php7-1/ClosureBoundVariable.php 3 0 0 0 php7-1/DynamicCalls.php 0 0 1 0 php7-1/Iterable.php 1 0 0 0 php7-1/JsonDecodeEmpty.php 0 0 0 0 php7-1/LongToIp.php 0 0 0 0 php7-1/RandAliasMtRand.php 0 0 0 0 php7-1/StringArray.php 0 0 0 0 php7-1/TooFewArguments.php 0 0 0 0 php7-1/Void.php 1 0 0 0 php7-2/CountNonCountables.php 0 0 0 0 php7-2/GetClassNull.php 0 0 0 0
  • 80. A N A LY S I S Table 1 File phpcs-error phpcs-warning php7cc-error php7cc-warning php7-2/HashInitNotResource.php 0 0 0 0 php7-2/NumberFormatNegativeZero.php 0 0 0 0 php7-2/Object.php 1 0 1 0 php7-2/UndefinedConstants.php 0 0 0 0 TOTAL 33 4 30 6 COUNT 23 3 27 5
  • 81. A N A LY S I S • Timing on 2364 files - php7cc - 276.595 seconds - PHPCompatibility - 271.26 seconds
  • 82. A N A LY S I S • Frameworks Table 1 phpcs time phpcs issues php7cc time php7cc issues File Count Zend 35.27 330 ERROR ERROR 2364 Symfony 171.41 34 144.611 133 3740 Slim 1.93 0 1.642 1 46 Wordpress 188.65 302 123.979 177 1280 Laravel 31.13 36 22.478 83 878
  • 83. L I V E E X A M P L E S
  • 84. Q U E S T I O N S ? https://joind.in/talk/6e322
  • 85. R E S O U R C E S • http://www.zend.com/en/resources/php7_infographic • https://github.com/sstalle/php7cc • https://github.com/wimg/PHPCompatibility