andrey Tue Aug 24 18:01:58 2004 EDT Modified files: /php-src README.PHP4-TO-PHP5-THIN-CHANGES Log: new incompatibilities. maybe someone from the doc group will update the migrating guide. also Derick may add new slides to his talk :) http://cvs.php.net/diff.php/php-src/README.PHP4-TO-PHP5-THIN-CHANGES?r1=1.16&r2=1.17&ty=u Index: php-src/README.PHP4-TO-PHP5-THIN-CHANGES diff -u php-src/README.PHP4-TO-PHP5-THIN-CHANGES:1.16 php-src/README.PHP4-TO-PHP5-THIN-CHANGES:1.17 --- php-src/README.PHP4-TO-PHP5-THIN-CHANGES:1.16 Sun Mar 28 04:30:21 2004 +++ php-src/README.PHP4-TO-PHP5-THIN-CHANGES Tue Aug 24 18:01:58 2004 @@ -77,20 +77,24 @@ 9. get_class() starting PHP 5 returns the name of the class as it was declared which may lead to problems in older scripts that rely on - the previous behaviour - the class name is lowercased. + the previous behaviour - the class name is lowercased. Expect the + same behaviour from get_parent_class() when applicable. Example : <?php class FooBar { } + class ExtFooBar extends FooBar{} $a = new FooBar(); - var_dump(get_class($a)); + var_dump(get_class($a), get_parent_class($a)); ?> Output (PHP 4): string(6) "foobar" + string(9) "extfoobar" Output (PHP 5): string(6) "FooBar" + string(9) "ExtFooBar" ---------------------------------------------------------------------- Example code that will break : //.... @@ -101,7 +105,51 @@ //... } //... - Possible solution is to search for get_class() in all your scripts and - use strtolower(). + Possible solution is to search for get_class() and get_parent_class() in + all your scripts and use strtolower(). + +10. get_class_methods() returns the names of the methods of a class as they + declared. In PHP4 the names are all lowercased. + Example code : + <?php + class Foo{ + function doFoo(){} + function hasFoo(){} + } + var_dump(get_class_methods("Foo")); + ?> + Output (PHP4): + array(2) { + [0]=> + string(5) "dofoo" + [1]=> + string(6) "hasfoo" + } + Output (PHP5): + array(2) { + [0]=> + string(5) "doFoo" + [1]=> + string(6) "hasFoo" + } + +11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special + meaning in class methods and is recognized by the PHP parser. The latter + will generate a parse error when assignment to $this is found + Example code : + <?php + class Foo { + function assignNew($obj) { + $this = $obj; + } + } + $a = new Foo(); + $b = new Foo(); + $a->assignNew($b); + echo "I was executed\n"; + ?> + Output (PHP 4): + I was executed + Output (PHP 5): + PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4 - \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php