13.5. Other Changes

Although the compatibility mode covers a few changes between PHP 4 and PHP 5, it does not fix all possible changes. For example, PHP 5 does not allow assigning to $this, which is a problem for a few PEAR classes (at the time of this writing). For example, the Pager/Pager.php file has the following code in its constructor:

$mode = (isset($options['mode']) ? $options['mode'] : 'Jumping');
$pager_class = 'Pager_' . ucfirst($mode);
$pager_classfile = 'Pager' . DIRECTORY_SEPARATOR . $mode . '.php';
require_once $pager_classfile;
$this = new $pager_class($options);

Another PHP 5 change not reverted by compatibility mode is the behavior of get_class().

13.5.1. Assigning to $this

When you use a line in PHP 4 that assigns a value ...

Get PHP 5 Power Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.