Deprecated: Assigning the return value of new by reference

Any off topic chat

Deprecated: Assigning the return value of new by reference

Postby Adminer » Wed Jul 28, 2010 5:22 pm

Razor and new PHP 5.3.

Message in Install.php:
"Deprecated: Assigning the return value of new by reference is deprecated in C:\SERVER2GO\htdocs\razor\install.php on line 431"

Solution:
line 431: $this->Entries[] = &new SimpleUnzipEntry($aI);
change on this:
$this->Entries[] = new SimpleUnzipEntry($aI);

In admin area I can see now a message "Deprecated: Assigning the return value of new by reference is deprecated in C:\SERVER2GO\htdocs\hydro\admin\lib\unzip.lib.php on line 387".

Solution:
line: 387: $this->Entries[] = $new SimpleUnzipEntry($aI);
change on this: $this->Entries[] = new SimpleUnzipEntry($aI);

The problem is only with new version of PHP 5.3.

Very interesting article about new PHP is here:
http://derickrethans.nl/files/phparch-p ... rticle.pdf
and here:
http://thinkinglemur.com/index.php/2009 ... eprecated/

Regards
Adminer
 
Posts: 222
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: Deprecated: Assigning the return value of new by referen

Postby Adminer » Mon Aug 09, 2010 5:11 pm

Another problems are with new PHP 5.3 and:

1. admin_func.php, line 4198, when you create new Razor Admin Username:
Code: Select all
//before if (ereg("[!?$%^&*():;@'~#<>?/\|{}]", $adminUsername)) {
     // my solution
        if (preg_match('/([a-z0-9])([-a-z0-9._])+([a-z0-9])\@([a-z0-9])([-a-z0-9_])+([a-z0-9])(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*/i', $adminUsername)) {
            $result = lt('Error username contains invalid characters').'...';
            return $result;
        }


ereg function is not supported in PHP 5.3.
Paul should have a look here - but it works for me ;-)

2. Contact form and PHP 5.3.:
Find and change all function to new one:
Code: Select all
//start
function contactForm_checkEmail($emailInput) {
  return preg_match( "/^([a-zA-Z0-9])+([a-zA-Z0-9._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9._-]+)+$/", $emailInput);
}
//end///////


Works with my e-mail in format xxx.yyy_zzz@gmail.com.
BTW, oryginal function was not working at all with all my tested e-mails ;-).

Regards
Adminer
 
Posts: 222
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: Deprecated: Assigning the return value of new by referen

Postby smiffy6969 » Wed Aug 18, 2010 8:17 am

Thanks for the heads up, the issue with deprecation is, we will always be on the back foot.

There will always be functions that get binned and the issue is we cannot see into the future, to degree though the server will still cope with the function.

The important thing here is not to report notices on any server you are running as this opens up security, say the host up issues php without you knowing, and there is a deprecated function now, now your server chucks out php errors, so people know your on a php server (if you where masking urls with sefurl)....... and so on.

Note to all.... Turn error reporting down to warnings only. When I test each release, I do so with error reporting turned to full, to catch these issues, but never run your production site with error reporting turned to all on your server.

To stop this, I may see if we can change this at run time and kill this off altogether.

adminer, your php seems quite good, fancy killing bugs for real, the project is now hosted on google code (svn) so if you fancy helping fix things around here, pm me.

smiffy
on a long enough time line, everyones survival rate drops to zero... [ed norton - fight club]
http://www.razorcms.co.uk
http://www.mis-limited.com
smiffy6969
Site Admin
 
Posts: 1372
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK


Return to Off topic

Who is online

Users browsing this forum: No registered users and 1 guest

cron