|
Released PHP 5 compliant MetaL engine
Manuel Lemos, 2004-05-11 22:00:00 GMT
A new revision of the MetaL engine that is compliant with PHP 5 was
released. Several classes that compose the different modules of the MetaL
compiler engine were fixed to make object cloning work under PHP 5 in parts
of the code where object copying was intentional.
These fixes are important because they make all MetaL engine applications
ready for use with PHP 5. These applications include
Metastorage, a Data Access Object (DAO)
classes generator tool.
PHP 5 introduces a change in the behavior of the assignment of object
variables. In previous PHP versions object assignment would result in the
creation of a new object copy.
Since in most cases object copying is not intended and would only add
runtime execution overhead, Zend developers have decided to change the
behavior of object assignment to make it just create a new reference to
the assigned object.
Despite it may lead to eventual backwards incompatibilities, this change
introduced in PHP 5 may also provide speed increase in the execution of
legacy PHP code that did not use explicit object references to prevent
unintended copying.
The MetaL engine code used object assignment in certain circumstances to
make intentional object copies. Such code was fixed by creating new objects
and assigning its variables with the original object variables values.
This way the MetaL engine is now compatible with PHP 5 as well with PHP 4
and even PHP 3, despite PHP 3 is no longer relevant because very few
developers are using it nowadays.
The effort of fixing the MetaL engine was not trivial because this project
consists of a large PHP code base of more than 50 classes of objects with
about 40,000 lines of code in total.
The fixing effort only became viable using a new type of E_STRICT
warning introduced in PHP 5 Release Candidate 2 (RC2). This type of
warning helps developers locating the file names and lines of source code
where implicit object cloning happens when using the Zend 1 engine
compatibility mode.
|
|