SlideShare a Scribd company logo
PHP 7.0'S
ERROR MESSAGES
HAVING FUN WITH ERRORS
PHPAmersfoort
AGENDA
• 2229 error messages to review
• New gotchas
• New features, new messages
SPEAKER
• Damien Seguy
• CTO at exakat
• "Ik ben een boterham" : I'm a resident
• Automated code audit services
EVOLUTION OF ERROR MESSAGES
SEARCHING FOR MESSAGES
• PHP-src repository
• zend_error
• zend_throw
• zend_throw_exception
• zend_error_throw
TOP 5 (FROM THE SOURCE)
1. Using $this when not in object context (192)
2. Cannot use string offset as an array (74)
3. Cannot use string offset as an object (56)
4. Only variable references should be yielded by
reference (52)
5. Undefined variable: %s (43)
TOP 5 (GOOGLE)
1. Call to undefined function
2. Class not found
3. Allowed memory size of
4. Undefined index
5. Undefined variable
EXCEPTIONS ARE ON THE RISE
AGENDA
• New error messages (New features)
• Better linting
• Removed messages
• Cryptic messages
NEW FEATURES
RETURN VALUE OF %S%S%S()
MUST %S%S, %S%S RETURNED
<?php   
  function x(): array {  
   return false;  
} 
   
?>
Uncaught TypeError: Return value of x() must be of the type array,
boolean returned in
RETURN VALUE OF %S%S%S()
MUST %S%S, %S%S RETURNED
<?php   
  function x(): array {  
   return ;  
  } 
   
?>
Uncaught TypeError: Return value of x() must be of the type array,
none returned in
ARGUMENT %D PASSED TO %S%S%S() MUST
%S%S, %S%S GIVEN, CALLED IN %S ON LINE
%D
<?php   
function x(array $a)  {  
  return false;  
} 
x(false); 
   
?>
Uncaught TypeError: Argument 1 passed to x() must be of the type
array, boolean given, called in
DEFAULT VALUE FOR PARAMETERS WITH
A FLOAT TYPE HINT CAN ONLY BE FLOAT
<?php   
    function foo(float $a = "3"){  
        return true;  
    }  
?> 
DEFAULT VALUE FOR PARAMETERS WITH
A FLOAT TYPE HINT CAN ONLY BE FLOAT
<?php   
    function foo(float $a =  3 ){  
        return true;  
    }  
?> 
CANNOT USE TEMPORARY
EXPRESSION IN WRITE CONTEXT
<?php  
'foo'[0] = 'b';  
?>
CANNOT USE TEMPORARY
EXPRESSION IN WRITE CONTEXT
<?php   
$a = 'foo';  
$a[0] = 'b';   
print $a;  
?>
CANNOT USE "%S" WHEN NO
CLASS SCOPE IS ACTIVE
<?php    
  function x(): parent {   
    return new bar();  
 }  
x();  
?>
• self
• parent
• static
CANNOT USE "%S" WHEN NO
CLASS SCOPE IS ACTIVE
<?php    
class bar extends baz {}   
class foo extends bar {  
  function x(): parent {   
    return new foo();  
 }  
}  
$x = new foo();  $x->x();  
?>
CANNOT USE "%S" WHEN NO
CLASS SCOPE IS ACTIVE
<?php    
class bar extends baz {}   
class foo extends bar {  
  function x(): parent {   
    return new bar();  
 }  
}  
$x = new foo();  $x->x();  
?>
CANNOT USE "%S" WHEN NO
CLASS SCOPE IS ACTIVE
<?php    
class baz {}   
class bar extends baz {}   
class foo extends bar {  
  function x(): parent {   
    return new baz();  
 }  
}  
$x = new foo(); $x->x();  
?>Uncaught TypeError: Return value of foo::x() must be an instance of
bar, instance of baz returned in
CANNOT USE "%S" WHEN NO
CLASS SCOPE IS ACTIVE
<?php    
class baz {}   
class bar extends baz {}   
class foo extends bar {  
  function x(): grandparent {   
    return new baz();  
 }  
}  
$x = new foo(); $x->x();  
?>Uncaught TypeError: Return value of foo::x() must be an instance of
grandparent, instance of bar returned
CANNOT DECLARE A RETURN
TYPE
• __construct
• __destruct
• __clone
• "PHP 4 constructor"
<?php   
class x {  
    function __construct() : array {  
        return true;  
    }  
    function x() : array {  
        return true;  
    }  
}  
?>
METHODS WITH THE SAME NAME AS THEIR CLASS
WILL NOT BE CONSTRUCTORS IN A FUTURE VERSION
OF PHP; %S HAS A DEPRECATED CONSTRUCTOR
<?php   
class x {  
    function x() : array {  
        return true;  
    }  
}  
?>
INVALID UTF-8 CODEPOINT
ESCAPE SEQUENCE
我爱你
<?php   
$a = "u{6211}u{7231}u{4f60}";  
echo $a;  
?> 
INVALID UTF-8 CODEPOINT
ESCAPE SEQUENCE
• Incompatible with PHP 5.6
• Good for literals
• Alternatives?
<?php   
$a = "u{de";  
echo $a;  
?> 
<?php  
echo mb_convert_encoding('&#x'.$unicode.';', 'UTF-8', 'HTML-ENTITIES');  
echo json_decode('"u'.$unicode.'"');  
echo html_entity_decode('&#'.hexdec($unicode).';', 0, 'UTF-8');  
     eval('"u{'.$unicode.'}n"');  
?>
NEW LINTING
A CLASS CONSTANT MUST NOT BE CALLED 'CLASS';
IT IS RESERVED FOR CLASS NAME FETCHING
• Used to be a parse error. Now a nice message.
• Still rarely useful
<?php   
class x {  
    const class = 1;  
}  
?>
A CLASS CONSTANT MUST NOT BE CALLED 'CLASS';
IT IS RESERVED FOR CLASS NAME FETCHING
• Used to be a parse error. Now a nice message.
• Still rarely useful
• Outside class will 

generate

the old error
<?php   
//class x {  
    const class = 1;  
//}  
?>
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting
identifier (T_STRING)
DYNAMIC CLASS NAMES ARE NOT
ALLOWED IN COMPILE-TIME ::CLASS FETCH
<?php    
$c = new class { 
function f() { 
echo $x::class; 
}
}; 
$c->f(); 
?>
REDEFINITION OF PARAMETER
$%S
<?php  
function foo($a, $a, $a) {  
  echo "$an";  
}  
foo(1,2,3);  
?>
SWITCH STATEMENTS MAY ONLY
CONTAIN ONE DEFAULT CLAUSE
<?php   
switch($x) {   
    case '1' :    
        break;   
    default :    
        break;   
    default :    
        break;   
    case '2' :    
        break;   
}   
?>
SWITCH STATEMENTS MAY ONLY
CONTAIN ONE DEFAULT CLAUSE
<?php   
switch($x) {   
    case 1 :    
        break;   
    case 0+1 :    
        break;   
    case '1' :    
        break;   
    case true :    
        break;   
    case 1.0 :    
        break;   
    case $y :    
        break;   
EXCEPTIONS MUST IMPLEMENT
THROWABLE
<?php    
throw new stdClass();
?> 
Fatal error: Uncaught Error: Cannot throw objects that do not
implement Throwable
EXCEPTIONS MUST IMPLEMENT
THROWABLE
<?php    
class e implements Throwable {
/* Methods */
 public function  getMessage() {}
 public function  getCode() {}
 public function  getFile() {}
 public function  getLine() {}
 public function  getTrace() {}
 public function  getTraceAsString() {}
 public function  getPrevious() {}
 public function  __toString() {}
}
?> 
Class e cannot implement interface Throwable, extend Exception or
Error instead
RETIRED MESSAGES
FATAL ERROR
<?php 
interface t{} 
trait t{} 
?>
Fatal error: Cannot redeclare class t in
CALL-TIME PASS-BY-REFERENCE
HAS BEEN REMOVED;
<?php  
$a = 3;  
function f($b) {  
    $b++;  
}  
f(&$a);  
print $a;  
?>
Fatal error: Call-time pass-by-reference has been removed; If you
would like to pass argument by reference, modify the declaration of
f(). in
HAS BEEN REMOVE
CALL-TIME PASS-BY-REFERENCE
HAS BEEN REMOVED;
<?php  
$a = 3;  
function f($b) {  
    $b++;  
}  
f(&$a);  
print $a;  
?>
PHP Parse error: syntax error, unexpected '&' in
CRYPTIC MESSAGES
MINIMUM VALUE MUST BE LESS THAN
OR EQUAL TO THE MAXIMUM VALUE
<?php 
var_dump(random_int(100, 999)); 
var_dump(random_int(-1000, 0)); 
var_dump(random_bytes(10)); 
?>
DIVISION OF PHP_INT_MIN BY
-1 IS NOT AN INTEGER
• PHP_INT_MIN is the smallest integer on PHP
• PHP_INT_MAX : 9223372036854775807
• PHP_INT_MIN : -9223372036854775808
• Division or multiplication leads to non-integer
• Uses the Integer Division intdiv()
WEBP DECODE: REALLOC
FAILED
• New image format for the Web
• Lossless compression, small files
• gdImageCreateFromWebpCtx emit this
• Probably very bad
FUNCTION NAME MUST BE A
STRING
<?php  
if ($_GET('X') == 'Go') {  
    ProcessFile();  
    return;  
}  
?>
ENCODING DECLARATION
PRAGMA MUST BE THE VERY
FIRST STATEMENT IN THE SCRIPT
NAMESPACE DECLARATION
STATEMENT HAS TO BE THE VERY
FIRST STATEMENT IN THE SCRIPT
NAMESPACE DECLARATION
STATEMENT HAS TO BE THE VERY
FIRST STATEMENT IN THE SCRIPT
ENCODING DECLARATION
PRAGMA MUST BE THE VERY
FIRST STATEMENT IN THE SCRIPT
<?php 
declare(encoding='ISO-8859-1'); 
namespace myNamespace; 
// code here 
// --enable-zend-multibyte
?>
FIRST STATEMENT EVER
YOU SEEM TO BE TRYING TO
USE A DIFFERENT LANGUAGE...
<?php  
use strict;
WHAT ABOUT MY CODE?
FUN WITH ERRORS
• Check the errors messages in your application
• die, exit
• echo, print, display, debug, wp_die

(depends on conventions)
• new *Exception()
• What does your application tells you?
• die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
• die("Error: application_top not found.nMake sure you have placed the
currency_cron.php file in your (renamed) Admin folder.nn");
• die('ERROR: admin/includes/configure.php file not found. Suggest running
zc_install/index.php?');
• die('I WOULD NOT ADD ' . $new_categories_sort_array[$i] . '<br>');
• die('NOTCONFIGURED');
• die('halted');
• die('<pre>' . print_r($inputs, true));
• die('HERE_BE_MONSTERS - could not open file');}
• die('HERE_BE_MONSTERS');}
• die($prod_id);
• die('here');
• die('Sorry. File not found. Please contact the webmaster to report this
error.<br />c/f: ' . $origin_filename);
DANK U WEL
@EXAKAT

More Related Content

What's hot

Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
Fwdays
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)
Win Yu
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Developmentjsmith92
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
Saraswathi Murugan
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 
PHP Conference Asia 2016
PHP Conference Asia 2016PHP Conference Asia 2016
PHP Conference Asia 2016
Britta Alex
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021
Ayesh Karunaratne
 
New in php 7
New in php 7New in php 7
New in php 7
Vic Metcalfe
 
Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?
Nikita Popov
 
Basic PHP
Basic PHPBasic PHP
Basic PHP
Todd Barber
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
Damien Seguy
 
SPL, not a bridge too far
SPL, not a bridge too farSPL, not a bridge too far
SPL, not a bridge too far
Michelangelo van Dam
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changed
Ayesh Karunaratne
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
Mark Baker
 
Overview changes in PHP 5.4
Overview changes in PHP 5.4Overview changes in PHP 5.4
Overview changes in PHP 5.4
Tien Xuan
 
Data Types In PHP
Data Types In PHPData Types In PHP
Data Types In PHP
Mark Niebergall
 
Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
Joshua Thijssen
 

What's hot (20)

Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Development
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
PHP Conference Asia 2016
PHP Conference Asia 2016PHP Conference Asia 2016
PHP Conference Asia 2016
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021
 
New in php 7
New in php 7New in php 7
New in php 7
 
Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?
 
Basic PHP
Basic PHPBasic PHP
Basic PHP
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
 
SPL, not a bridge too far
SPL, not a bridge too farSPL, not a bridge too far
SPL, not a bridge too far
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changed
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
Overview changes in PHP 5.4
Overview changes in PHP 5.4Overview changes in PHP 5.4
Overview changes in PHP 5.4
 
Data Types In PHP
Data Types In PHPData Types In PHP
Data Types In PHP
 
Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
 

Similar to Php 7 errors messages

Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
Michelangelo van Dam
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Hisateru Tanaka
 
Damien seguy php 5.6
Damien seguy php 5.6Damien seguy php 5.6
Damien seguy php 5.6
Damien Seguy
 
Php
PhpPhp
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
chartjes
 
Preparing for the next php version
Preparing for the next php versionPreparing for the next php version
Preparing for the next php version
Damien Seguy
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions
Jagat Kothari
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overviewjsmith92
 
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Jalpesh Vasa
 
Phpspec tips&amp;tricks
Phpspec tips&amp;tricksPhpspec tips&amp;tricks
Phpspec tips&amp;tricks
Filip Golonka
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
SWIFTotter Solutions
 
Fatc
FatcFatc
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
John Cleveley
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
ZendVN
 
99% is not enough
99% is not enough99% is not enough
99% is not enough
tech.kartenmacherei
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
Mark Baker
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
Marek Sotak
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)
Nikita Popov
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
Marcello Duarte
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
Joey Kudish
 

Similar to Php 7 errors messages (20)

Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Damien seguy php 5.6
Damien seguy php 5.6Damien seguy php 5.6
Damien seguy php 5.6
 
Php
PhpPhp
Php
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Preparing for the next php version
Preparing for the next php versionPreparing for the next php version
Preparing for the next php version
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
 
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
 
Phpspec tips&amp;tricks
Phpspec tips&amp;tricksPhpspec tips&amp;tricks
Phpspec tips&amp;tricks
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
Fatc
FatcFatc
Fatc
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
 
99% is not enough
99% is not enough99% is not enough
99% is not enough
 
A Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP GeneratorsA Functional Guide to Cat Herding with PHP Generators
A Functional Guide to Cat Herding with PHP Generators
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)
 
PHPSpec BDD Framework
PHPSpec BDD FrameworkPHPSpec BDD Framework
PHPSpec BDD Framework
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 

More from Damien Seguy

Strong typing @ php leeds
Strong typing  @ php leedsStrong typing  @ php leeds
Strong typing @ php leeds
Damien Seguy
 
Strong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisationStrong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisation
Damien Seguy
 
Qui a laissé son mot de passe dans le code
Qui a laissé son mot de passe dans le codeQui a laissé son mot de passe dans le code
Qui a laissé son mot de passe dans le code
Damien Seguy
 
Analyse statique et applications
Analyse statique et applicationsAnalyse statique et applications
Analyse statique et applications
Damien Seguy
 
Top 10 pieges php afup limoges
Top 10 pieges php   afup limogesTop 10 pieges php   afup limoges
Top 10 pieges php afup limoges
Damien Seguy
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020
Damien Seguy
 
Meilleur du typage fort (AFUP Day, 2020)
Meilleur du typage fort (AFUP Day, 2020)Meilleur du typage fort (AFUP Day, 2020)
Meilleur du typage fort (AFUP Day, 2020)
Damien Seguy
 
Top 10 php classic traps confoo
Top 10 php classic traps confooTop 10 php classic traps confoo
Top 10 php classic traps confoo
Damien Seguy
 
Tout pour se préparer à PHP 7.4
Tout pour se préparer à PHP 7.4Tout pour se préparer à PHP 7.4
Tout pour se préparer à PHP 7.4
Damien Seguy
 
Top 10 php classic traps php serbia
Top 10 php classic traps php serbiaTop 10 php classic traps php serbia
Top 10 php classic traps php serbia
Damien Seguy
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
Damien Seguy
 
Top 10 chausse trappes
Top 10 chausse trappesTop 10 chausse trappes
Top 10 chausse trappes
Damien Seguy
 
Code review workshop
Code review workshopCode review workshop
Code review workshop
Damien Seguy
 
Understanding static analysis php amsterdam 2018
Understanding static analysis   php amsterdam 2018Understanding static analysis   php amsterdam 2018
Understanding static analysis php amsterdam 2018
Damien Seguy
 
Review unknown code with static analysis php ce 2018
Review unknown code with static analysis   php ce 2018Review unknown code with static analysis   php ce 2018
Review unknown code with static analysis php ce 2018
Damien Seguy
 
Everything new with PHP 7.3
Everything new with PHP 7.3Everything new with PHP 7.3
Everything new with PHP 7.3
Damien Seguy
 
Php 7.3 et ses RFC (AFUP Toulouse)
Php 7.3 et ses RFC  (AFUP Toulouse)Php 7.3 et ses RFC  (AFUP Toulouse)
Php 7.3 et ses RFC (AFUP Toulouse)
Damien Seguy
 
Tout sur PHP 7.3 et ses RFC
Tout sur PHP 7.3 et ses RFCTout sur PHP 7.3 et ses RFC
Tout sur PHP 7.3 et ses RFC
Damien Seguy
 
Review unknown code with static analysis php ipc 2018
Review unknown code with static analysis   php ipc 2018Review unknown code with static analysis   php ipc 2018
Review unknown code with static analysis php ipc 2018
Damien Seguy
 
Code review for busy people
Code review for busy peopleCode review for busy people
Code review for busy people
Damien Seguy
 

More from Damien Seguy (20)

Strong typing @ php leeds
Strong typing  @ php leedsStrong typing  @ php leeds
Strong typing @ php leeds
 
Strong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisationStrong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisation
 
Qui a laissé son mot de passe dans le code
Qui a laissé son mot de passe dans le codeQui a laissé son mot de passe dans le code
Qui a laissé son mot de passe dans le code
 
Analyse statique et applications
Analyse statique et applicationsAnalyse statique et applications
Analyse statique et applications
 
Top 10 pieges php afup limoges
Top 10 pieges php   afup limogesTop 10 pieges php   afup limoges
Top 10 pieges php afup limoges
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020
 
Meilleur du typage fort (AFUP Day, 2020)
Meilleur du typage fort (AFUP Day, 2020)Meilleur du typage fort (AFUP Day, 2020)
Meilleur du typage fort (AFUP Day, 2020)
 
Top 10 php classic traps confoo
Top 10 php classic traps confooTop 10 php classic traps confoo
Top 10 php classic traps confoo
 
Tout pour se préparer à PHP 7.4
Tout pour se préparer à PHP 7.4Tout pour se préparer à PHP 7.4
Tout pour se préparer à PHP 7.4
 
Top 10 php classic traps php serbia
Top 10 php classic traps php serbiaTop 10 php classic traps php serbia
Top 10 php classic traps php serbia
 
Top 10 php classic traps
Top 10 php classic trapsTop 10 php classic traps
Top 10 php classic traps
 
Top 10 chausse trappes
Top 10 chausse trappesTop 10 chausse trappes
Top 10 chausse trappes
 
Code review workshop
Code review workshopCode review workshop
Code review workshop
 
Understanding static analysis php amsterdam 2018
Understanding static analysis   php amsterdam 2018Understanding static analysis   php amsterdam 2018
Understanding static analysis php amsterdam 2018
 
Review unknown code with static analysis php ce 2018
Review unknown code with static analysis   php ce 2018Review unknown code with static analysis   php ce 2018
Review unknown code with static analysis php ce 2018
 
Everything new with PHP 7.3
Everything new with PHP 7.3Everything new with PHP 7.3
Everything new with PHP 7.3
 
Php 7.3 et ses RFC (AFUP Toulouse)
Php 7.3 et ses RFC  (AFUP Toulouse)Php 7.3 et ses RFC  (AFUP Toulouse)
Php 7.3 et ses RFC (AFUP Toulouse)
 
Tout sur PHP 7.3 et ses RFC
Tout sur PHP 7.3 et ses RFCTout sur PHP 7.3 et ses RFC
Tout sur PHP 7.3 et ses RFC
 
Review unknown code with static analysis php ipc 2018
Review unknown code with static analysis   php ipc 2018Review unknown code with static analysis   php ipc 2018
Review unknown code with static analysis php ipc 2018
 
Code review for busy people
Code review for busy peopleCode review for busy people
Code review for busy people
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

Php 7 errors messages

  • 1. PHP 7.0'S ERROR MESSAGES HAVING FUN WITH ERRORS PHPAmersfoort
  • 2. AGENDA • 2229 error messages to review • New gotchas • New features, new messages
  • 3. SPEAKER • Damien Seguy • CTO at exakat • "Ik ben een boterham" : I'm a resident • Automated code audit services
  • 5. SEARCHING FOR MESSAGES • PHP-src repository • zend_error • zend_throw • zend_throw_exception • zend_error_throw
  • 6. TOP 5 (FROM THE SOURCE) 1. Using $this when not in object context (192) 2. Cannot use string offset as an array (74) 3. Cannot use string offset as an object (56) 4. Only variable references should be yielded by reference (52) 5. Undefined variable: %s (43)
  • 7. TOP 5 (GOOGLE) 1. Call to undefined function 2. Class not found 3. Allowed memory size of 4. Undefined index 5. Undefined variable
  • 8. EXCEPTIONS ARE ON THE RISE
  • 9. AGENDA • New error messages (New features) • Better linting • Removed messages • Cryptic messages
  • 11. RETURN VALUE OF %S%S%S() MUST %S%S, %S%S RETURNED <?php      function x(): array {      return false;   }      ?> Uncaught TypeError: Return value of x() must be of the type array, boolean returned in
  • 12. RETURN VALUE OF %S%S%S() MUST %S%S, %S%S RETURNED <?php      function x(): array {      return ;     }      ?> Uncaught TypeError: Return value of x() must be of the type array, none returned in
  • 13. ARGUMENT %D PASSED TO %S%S%S() MUST %S%S, %S%S GIVEN, CALLED IN %S ON LINE %D <?php    function x(array $a)  {     return false;   }  x(false);      ?> Uncaught TypeError: Argument 1 passed to x() must be of the type array, boolean given, called in
  • 14. DEFAULT VALUE FOR PARAMETERS WITH A FLOAT TYPE HINT CAN ONLY BE FLOAT <?php        function foo(float $a = "3"){           return true;       }   ?> 
  • 15. DEFAULT VALUE FOR PARAMETERS WITH A FLOAT TYPE HINT CAN ONLY BE FLOAT <?php        function foo(float $a =  3 ){           return true;       }   ?> 
  • 16. CANNOT USE TEMPORARY EXPRESSION IN WRITE CONTEXT <?php   'foo'[0] = 'b';   ?>
  • 17. CANNOT USE TEMPORARY EXPRESSION IN WRITE CONTEXT <?php    $a = 'foo';   $a[0] = 'b';    print $a;   ?>
  • 18. CANNOT USE "%S" WHEN NO CLASS SCOPE IS ACTIVE <?php       function x(): parent {        return new bar();    }   x();   ?> • self • parent • static
  • 19. CANNOT USE "%S" WHEN NO CLASS SCOPE IS ACTIVE <?php     class bar extends baz {}    class foo extends bar {     function x(): parent {        return new foo();    }   }   $x = new foo();  $x->x();   ?>
  • 20. CANNOT USE "%S" WHEN NO CLASS SCOPE IS ACTIVE <?php     class bar extends baz {}    class foo extends bar {     function x(): parent {        return new bar();    }   }   $x = new foo();  $x->x();   ?>
  • 21. CANNOT USE "%S" WHEN NO CLASS SCOPE IS ACTIVE <?php     class baz {}    class bar extends baz {}    class foo extends bar {     function x(): parent {        return new baz();    }   }   $x = new foo(); $x->x();   ?>Uncaught TypeError: Return value of foo::x() must be an instance of bar, instance of baz returned in
  • 22. CANNOT USE "%S" WHEN NO CLASS SCOPE IS ACTIVE <?php     class baz {}    class bar extends baz {}    class foo extends bar {     function x(): grandparent {        return new baz();    }   }   $x = new foo(); $x->x();   ?>Uncaught TypeError: Return value of foo::x() must be an instance of grandparent, instance of bar returned
  • 23. CANNOT DECLARE A RETURN TYPE • __construct • __destruct • __clone • "PHP 4 constructor" <?php    class x {       function __construct() : array {           return true;       }       function x() : array {           return true;       }   }   ?>
  • 24. METHODS WITH THE SAME NAME AS THEIR CLASS WILL NOT BE CONSTRUCTORS IN A FUTURE VERSION OF PHP; %S HAS A DEPRECATED CONSTRUCTOR <?php    class x {       function x() : array {           return true;       }   }   ?>
  • 25. INVALID UTF-8 CODEPOINT ESCAPE SEQUENCE 我爱你 <?php    $a = "u{6211}u{7231}u{4f60}";   echo $a;   ?> 
  • 26. INVALID UTF-8 CODEPOINT ESCAPE SEQUENCE • Incompatible with PHP 5.6 • Good for literals • Alternatives? <?php    $a = "u{de";   echo $a;   ?>  <?php   echo mb_convert_encoding('&#x'.$unicode.';', 'UTF-8', 'HTML-ENTITIES');   echo json_decode('"u'.$unicode.'"');   echo html_entity_decode('&#'.hexdec($unicode).';', 0, 'UTF-8');        eval('"u{'.$unicode.'}n"');   ?>
  • 28. A CLASS CONSTANT MUST NOT BE CALLED 'CLASS'; IT IS RESERVED FOR CLASS NAME FETCHING • Used to be a parse error. Now a nice message. • Still rarely useful <?php    class x {       const class = 1;   }   ?>
  • 29. A CLASS CONSTANT MUST NOT BE CALLED 'CLASS'; IT IS RESERVED FOR CLASS NAME FETCHING • Used to be a parse error. Now a nice message. • Still rarely useful • Outside class will 
 generate
 the old error <?php    //class x {       const class = 1;   //}   ?> Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING)
  • 30. DYNAMIC CLASS NAMES ARE NOT ALLOWED IN COMPILE-TIME ::CLASS FETCH <?php     $c = new class {  function f() {  echo $x::class;  } };  $c->f();  ?>
  • 32. SWITCH STATEMENTS MAY ONLY CONTAIN ONE DEFAULT CLAUSE <?php    switch($x) {        case '1' :             break;        default :             break;        default :             break;        case '2' :             break;    }    ?>
  • 33. SWITCH STATEMENTS MAY ONLY CONTAIN ONE DEFAULT CLAUSE <?php    switch($x) {        case 1 :             break;        case 0+1 :             break;        case '1' :             break;        case true :             break;        case 1.0 :             break;        case $y :             break;   
  • 34. EXCEPTIONS MUST IMPLEMENT THROWABLE <?php     throw new stdClass(); ?>  Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable
  • 38. CALL-TIME PASS-BY-REFERENCE HAS BEEN REMOVED; <?php   $a = 3;   function f($b) {       $b++;   }   f(&$a);   print $a;   ?> Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of f(). in HAS BEEN REMOVE
  • 39. CALL-TIME PASS-BY-REFERENCE HAS BEEN REMOVED; <?php   $a = 3;   function f($b) {       $b++;   }   f(&$a);   print $a;   ?> PHP Parse error: syntax error, unexpected '&' in
  • 41. MINIMUM VALUE MUST BE LESS THAN OR EQUAL TO THE MAXIMUM VALUE <?php  var_dump(random_int(100, 999));  var_dump(random_int(-1000, 0));  var_dump(random_bytes(10));  ?>
  • 42. DIVISION OF PHP_INT_MIN BY -1 IS NOT AN INTEGER • PHP_INT_MIN is the smallest integer on PHP • PHP_INT_MAX : 9223372036854775807 • PHP_INT_MIN : -9223372036854775808 • Division or multiplication leads to non-integer • Uses the Integer Division intdiv()
  • 43. WEBP DECODE: REALLOC FAILED • New image format for the Web • Lossless compression, small files • gdImageCreateFromWebpCtx emit this • Probably very bad
  • 44. FUNCTION NAME MUST BE A STRING <?php   if ($_GET('X') == 'Go') {       ProcessFile();       return;   }   ?>
  • 45. ENCODING DECLARATION PRAGMA MUST BE THE VERY FIRST STATEMENT IN THE SCRIPT
  • 46. NAMESPACE DECLARATION STATEMENT HAS TO BE THE VERY FIRST STATEMENT IN THE SCRIPT
  • 47. NAMESPACE DECLARATION STATEMENT HAS TO BE THE VERY FIRST STATEMENT IN THE SCRIPT ENCODING DECLARATION PRAGMA MUST BE THE VERY FIRST STATEMENT IN THE SCRIPT
  • 49. YOU SEEM TO BE TRYING TO USE A DIFFERENT LANGUAGE... <?php   use strict;
  • 50. WHAT ABOUT MY CODE?
  • 51. FUN WITH ERRORS • Check the errors messages in your application • die, exit • echo, print, display, debug, wp_die
 (depends on conventions) • new *Exception() • What does your application tells you?
  • 52. • die('I SEE ' . $action . ' - ' . $_POST['categories_id']); • die("Error: application_top not found.nMake sure you have placed the currency_cron.php file in your (renamed) Admin folder.nn"); • die('ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?'); • die('I WOULD NOT ADD ' . $new_categories_sort_array[$i] . '<br>'); • die('NOTCONFIGURED'); • die('halted'); • die('<pre>' . print_r($inputs, true)); • die('HERE_BE_MONSTERS - could not open file');} • die('HERE_BE_MONSTERS');} • die($prod_id); • die('here'); • die('Sorry. File not found. Please contact the webmaster to report this error.<br />c/f: ' . $origin_filename);