File: compat_php5.php

package info (click to toggle)
typo3-src 4.0.2%2Bdebian-9
  • links: PTS
  • area: main
  • in suites: etch
  • size: 29,956 kB
  • ctags: 33,382
  • sloc: php: 134,523; xml: 6,976; sh: 1,698; sql: 1,084; makefile: 45
file content (37 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (2)
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
<?php
/**
 * TYPO3 compatibility layer PHP4 <> PHP5
 * These functions provide PHP5 functionality when not available (in PHP4).
 *
 * @author	Ren Fritz <r.fritz@colorcube.de>
 */


/**
 * borrowed from PEAR
 * @author Aidan Lister <aidan@php.net>
 */

eval('
    function clone($object)
    {
        // Sanity check
        if (!is_object($object)) {
            user_error(\'clone() __clone method called on non-object\', E_USER_WARNING);
            return;
        }

        // Use serialize/unserialize trick to deep copy the object
        $object = unserialize(serialize($object));

        // If there is a __clone method call it on the "new" class
        if (method_exists($object, \'__clone\')) {
            $object->__clone();
        }

        return $object;
    }
');


?>