Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

It is said that deprecated functions used in plugins & themes can crash a wordress website while upgrading to newer version, I want to see an example of deprecated function that can cause a crash.

Can someone show me an example?

Many Thanks!

share|improve this question
1  
They'll trigger a fatal error if they were finally removed in the new version yet were still in use. But nothing different than a regular PHP "call to undefined function" (or WSOD if debugging is disabled). –  TheDeadMedic Jul 8 '13 at 10:10
    
@TheDeadMedic Should be an answer :) –  kaiser Jul 8 '13 at 10:48
add comment

1 Answer

up vote 2 down vote accepted

Where...

The following files hold the deprecated functions:

  • ~/wp-includes/deprectated.php
  • ~/wp-includes/pluggable-deprectated.php
  • ...

Take a look at them and then through their replacement functions, where the calls to _deprecated_function() happen.

Why...

Normally a crash shouldn't happen. In the "real" PHP world, you'd get an E_DEPRECATED Warning. In WordPress you'll get a trigger_error() return caused by _deprecated_function() calls. The second trigger_error() argument isn't used, so it defaults to E_USER_NOTICE and won't stop your application from running.

How to turn it off...

You can turn this off either by using define( 'WP_DEBUG', false ); or by using a MU-Plugin that sets the filter to false:

<?php
defined('ABSPATH') or exit;
/** Plugin Name: (#105686) Turn off deprecated Warnings */
add_filter( 'deprecated_function_trigger_error', '__return_false' );
share|improve this answer
    
nice answer but I want to see an example of why WP sites crash while upgrading, can you please give me an example? –  Tahir Yasin Jul 8 '13 at 10:46
    
@TahirYasin I have no example, as there is none. Deactivate debug or use the MU-Plugin and you're fine. As I explained, it's an E_NOTICE, not an E_ERROR. The only thing I could imagine is that it echos inside some call where nothing should echo. For example during plugin activation. Just update your question with a real world example. So far you're too abstract. –  kaiser Jul 8 '13 at 10:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.