Manuel PHP

Nouveaux messages d'erreurs

Trouvez ci-dessous les nouveaux messages d'erreurs qui n'ont pas encore été abordés dans ce document.

Exemple #1 Dans le coeur de PHP

  1. <?php
  2. echo " ";  
  3. session_regenerate_id();  
  4. /* Warning: session_regenerate_id(): Cannot regenerate
  5.    session id - headers already sent in filename on line n */  
  6.  
  7. str_word_count("string", 4);  
  8. /* Warning: str_word_count(): Invalid format value 4
  9. in filename on line n */  
  10.  
  11. strripos("foo", "f", 4);  
  12. /* Notice: strripos(): Offset is greater than the
  13. length of haystack string in filename on line n */  
  14.  
  15. strrpos("foo", "f", 4);  
  16. /* Notice: strrpos(): Offset is greater than the
  17. length of haystack string in filename on line n */  
  18.  
  19. /* As of PHP 5.2.1, when allow_url_include is OFF (default) */  
  20. include "php://input";  
  21. /* Warning: include(): URL file-access is disabled
  22. in the server configuration in filename on line n */  
  23. ?> 

Exemple #2 Dans le coeur orienté objet de PHP

  1. <?php
  2. interface foo {  
  3. }  
  4. class bar implements foo, foo {  
  5. }  
  6. /* Fatal error: Class bar cannot implement previously
  7. implemented interface foo in filename on line n */  
  8.  
  9.  
  10. class foo { 
  11.    public $bar; 
  12.    function __get($var) 
  13.    { 
  14.       return $this->bar; 
  15.    }  
  16. }  
  17.  
  18. $foo = new foo;  
  19. $bar =& $foo->prop;  
  20. /* Notice: Indirect modification of overloaded property
  21. foo::$prop has no effect in filename on line n */  
  22.  
  23.  
  24. class foo implements iterator { 
  25.    public function current() { 
  26.    } 
  27.    public function next() { 
  28.    } 
  29.    public function key() { 
  30.    } 
  31.    public function valid() { 
  32.    } 
  33.    public function rewind() { 
  34.    }  
  35. }  
  36.  
  37. $foo = new foo();  
  38. foreach($foo as &$ref) {}  
  39. /* Fatal error: An iterator cannot be used with foreach
  40. by reference in filename on line n */  
  41.  
  42.  
  43. class foo { 
  44.    private function __construct() { 
  45.    }  
  46. }  
  47. class bar extends foo { 
  48.    public function __construct() { 
  49.       parent::__construct(); 
  50.       /* Fatal error: Cannot call private
  51.        foo::__construct() in filename on line n */ 
  52.    }  
  53. }  
  54. new bar;  
  55.  
  56.  
  57. stream_filter_register("", "class");  
  58. /* Warning: stream_filter_register(): Filter name
  59. cannot be empty in filename on line n */  
  60.  
  61.  
  62. stream_filter_register("filter", "");  
  63. /* Warning: stream_filter_register(): Class name
  64. cannot be empty in filename on line n */  
  65. ?> 

Exemple #3 Dans l'extension bzip2

  1. <?php
  2. bzopen("", "w");  
  3. /* Warning: bzopen(): filename cannot be empty
  4. in filename on line n */  
  5.  
  6. bzopen("foo", "a");  
  7. /* Warning: bzopen(): 'a' is not a valid mode for
  8. bzopen(). Only 'w' and 'r' are supported in
  9. filename on line n */  
  10.  
  11. $fp = fopen("foo", "w");  
  12. bzopen($fp, "r");  
  13. /* Warning: bzopen(): cannot read from a stream
  14. opened in write only mode in filename on line n */  
  15. ?> 

Exemple #4 Dans l'extension datetime

  1. <?php
  2. strtotime("today", "now");  
  3. /* Warning: strtotime() expects parameter 2 to be
  4. long, string given in filename on line n */  
  5.  
  6. /* As of PHP 5.2.1 */  
  7. new DateTime(new stdclass);  
  8. /* Fatal error: Uncaught exception 'Exception' with
  9. message 'DateTime::__construct() expects parameter
  10. 1 to be string, object given' in filename:n */  
  11. ?> 

Exemple #5 Dans l'extension dBase

  1. <?php
  2. dbase_open("foo", -1);  
  3. /* Warning: Invalid access mode -1 in filename on line n */  
  4.  
  5. /* As of PHP 5.2.1 */  
  6. dbase_open("foo", null);  
  7. /* Warning: The filename cannot be empty in filename on line n */  
  8. ?> 

Exemple #6 Dans l'extension mcrypt

  1. <?php
  2. $key = "this is a secret key";  
  3. $td = mcrypt_module_open('tripledes', '', 'ecb', '');  
  4. $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), 
  5.                   MCRYPT_RAND);  
  6. mcrypt_generic_init($td, $key, $iv);  
  7. $encrypted_data = mcrypt_generic($td, "");  
  8. /* Warning: mcrypt_generic(): An empty string was
  9. passed in filename on line n */  
  10. ?> 

Exemple #7 Dans l'extension oci8

  1. <?php
  2. oci_connect("user", "pass", "db", "bogus_charset");  
  3. /* Warning: Invalid character set name:
  4. bogus_charset in filename on line n */  
  5.  
  6. $oci = oci_connect("user", "pass", "db");  
  7. oci_password_change($oci, "", "old", "new");  
  8. /* Warning: username cannot be empty in filename
  9. on line n */  
  10.  
  11. oci_password_change($oci, "user", "", "new");  
  12. /* Warning: old password cannot be empty in filename
  13. on line n */  
  14.  
  15. oci_password_change($oci, "user", "old", "");  
  16. /* Warning: new password cannot be empty in filename
  17. on line n */  
  18. ?> 

Exemple #8 Dans l'extension SPL

  1. <?php
  2. $obj = new SplFileObject(__FILE__);  
  3. $obj->fgetcsv("foo");  
  4. /* Warning: SplFileObject::fgetcsv(): delimiter must
  5. be a character in filename on line n */  
  6.  
  7. $obj->fgetcsv(",", "foo");  
  8. /* Warning: SplFileObject::fgetcsv(): enclosure must
  9. be a character in filename on line n */  
  10. ?> 

Exemple #9 Dans l'extension Semaphore (sysvmsg)

  1. <?php
  2. /* Warning: maximum size of the message has to be
  3. greater then zero in filename on line n */  
  4. ?> 

Exemple #10 Un exemple en PHP 5.2.1+ de Zip

  1. <?php
  2. $obj = new ZipArchive();  
  3. $obj->open('archive.zip');  
  4. $obj->setCommentName('', 'comment');  
  5. /* Notice: ZipArchive::setCommentName(): Empty string
  6. as entry name in filename on line n */  
  7.  
  8. /* As of PHP 5.2.1 */  
  9. $obj->getCommentName('');  
  10. /* Notice: ZipArchive::getCommentName(): Empty string
  11. as entry name in filename on line n */  
  12. ?> 


Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique