php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29327 Implicit cloning error
Submitted: 2004-07-22 13:24 UTC Modified: 2004-08-02 11:05 UTC
From: jules at infinityblue dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2004-07-22 13:24 UTC] jules at infinityblue dot com
Description:
------------
I have a small issue with a PHP 4 developed application on PHP5. Current I get the following error message:

PHP ERROR : , ERROR CODE: 2048, MESSAGE: Implicit cloning object of class
'testErrors' because of 'zend.ze1_compatibility_mode', FILE:
c:\eclipse\workspace\myapp\index_test.php, LINE: 6

I'm loading an error handler. It immediatly trips of the error hander with the above error.  This code works on PHP 4.2.4.

The following changes were made to the php.ini (taken from php.ini-recommended) for PHP 5:
zend.ze1_compatibility_mode = On
display_errors = on
error_reporting  =  E_ALL
extension=php_mysql.dll
extension_dir = "ext/"

Server is running on Apache 1.3.29. No segmentation faults have been noted in the logs


Reproduce code:
---------------
The first file index_test.php looks as follows:
<?
if (!class_exists('testErrors'))
 include "testErrors.php";
$cErrorHandler = new testErrors();
?>

And testErrors.php looks like:
<?
class testErrors {

 function testErrors() {

  function HandleError($number, $message, $file, $line) {
     global $iErrorsShow, $iLogErrors;

   $mErrorMessage = 'PHP ERROR : ';
   $mErrorMessage .= ', ERROR CODE: ' . $number;
   $mErrorMessage .= ', MESSAGE: ' . $message;
   $mErrorMessage .= ', FILE: ' . $file;
   $mErrorMessage .= ', LINE: ' . $line;

   echo "The error message: $mErrorMessage<br>";
  }
  // declare the above function to handle all PHP errors
  set_error_handler('HandleError');
 }
}
?>

Expected result:
----------------
I expect the class to be loaded and the erro handler to be working *without* echoing the contents of:

echo "The error message: $mErrorMessage<br>";


Actual result:
--------------
The error message: PHP ERROR : , ERROR CODE: 2048, MESSAGE: Implicit cloning object of class 'testErrors' because of 'zend.ze1_compatibility_mode', FILE: c:\eclipse\workspace\sitemanager\infinityadmin\index_test.php, LINE: 6

Error handler is set off with the above error message. But in theory no error should have been caused. 

This error is also error code 2048. This is surely E_STRICT error reporting, however, php.ini is set to E_ALL. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-02 11:05 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Please read the docs. The error handler receives all types of errors even if you don\'t have them in your error reporting setting.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 15 17:00:02 2025 UTC