summaryrefslogtreecommitdiff
path: root/README.PHP4-TO-PHP5-THIN-CHANGES
blob: 909e3bf6a8e10dc4b3409976f8358d48b590339a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
1. strrpos() and strripos() now use the entire string as a needle.
   Be aware that the existing scripts may no longer work as you expect.

   EX :
   <?php
   var_dump(strrpos("ABCDEF","DEF"));
   var_dump(strrpos("ABCDEF","DAF"));
   ?>

   Will give you different results. The former returns 3 while the latter
   returns false rather than the position of the last occurrence of 'D'.
   The same applies to strripos().

2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.

   EX :
   <?php
   $a = "foo";
   unset($a[0][1][2]);
   ?>

   Fatal error: Cannot use string offset as an array in ... on line 1

3. array_merge() was changed to accept only arrays. If a non-array variable is
   passed, a E_WARNING will be thrown for every such parameter. Be careful
   because your code may start emitting E_WARNING out of the blue.

4. Be careful when porting from ext/mysql to ext/mysqli. The following
   functions return NULL when no more data is available in the result set
   (ext/mysql's functions return FALSE).

    - mysqli_fetch_row()
    - mysqli_fetch_array()
    - mysqli_fetch_assoc()

5. PATH_TRANSLATED server variable is no longer set implicitly under
   Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
   same value as the SCRIPT_FILENAME server variable when it is not populated
   by Apache.  This change was made to comply with the CGI specification.
   Please refer to bug #23610 for further information.

6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
   ext/tokenizer extension. If error_reporting is set to E_ALL notices will
   be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant 
   is used, thus both // and /* */ are resolved as the T_COMMENT constant.
   However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
   by PHP, are recongnized as T_DOC_COMMENT.

7. $_SERVER should be populated with argc and argv if variables_order
   includes "S".  If you have specifically configured your system to not
   create $_SERVER, then of course it shouldn't be there.  The change was to
   always make argc and argv available in the CLI version regardless of the
   variables_order setting.  As in, the CLI version will now always populate
   the global $argc and $argv variables.

8. Classes must be declared before used:
   <?php
   $test = new fubar();
   $test->echo();

   class fubar {
       function echo() {
           echo 'fubar';
       }
   }
   ?>
   This script is perfectly valid and works in PHP 4 but with PHP 5 there
   will be a fatal error like :
   Fatal error: Class 'fubar' not found in ....
   If there is defined function __autoload() it will be called.