-
[Solved] Blank Pages with Wordpress 2.6.x
After upgrading to Wordpress 2.6 it occasionally happend that an empty page was displayed in the browser when navigating through the blog or working in the admin area. Refreshing the browser using CTRL+F5 usually helped in that case. Today I upgraded to Wordpress 2.6.2 and I was not able to access the plug-ins page of the admin area anymore. No matter how often I refreshed the page in the browser it stayed blank.
First I searched the web for possible solutions. I found quite a number of discussions giving tips about this widely known problem but unfortunately none of these solutions helped in my case.
So I again started debugging the Wordpress code and finally found the lines of code causing the trouble. The problem are (object) casts in the wp-includes/taxonomy.php file that transform an array into an object:$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count'); $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);Since I don’t get any error messages neither on the screen nor in the log files I have no idea why these casts fail. The PHP version used to serve the site is the latest stable 5.x release from php.net.
As a workaround I introduced a function that does also transforms an array into an object but does not rely on the casting mechanism.function arr2obj($arr) { foreach ($arr as $k => $v) $obj -> {$k} = $v; return $obj; } $wp_taxonomies['category'] = arr2obj(array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count')); $wp_taxonomies['post_tag'] = arr2obj(array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count')); $wp_taxonomies['link_category'] = arr2obj(array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false)); -
Sun JDK5/6 compilers broken when linking overloaded methods with variable arguments
We are currently switching the build system of OVal from custom Ant scripts to Maven 2. During that process we accidentally compiled the project using the Java compiler of the Sun JDK 5 instead of the AspectJ compiler. Surprisingly javac did not complain about the missing aspect class files. Instead it already aborted while compiling an ordinary Java class which only referenced other non-AspectJ related classes. This is the original error message:
[INFO] [compiler:compile] [INFO] Compiling 180 source files to C:\projects\oval\src\trunk\target\classes [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure C:\projects\oval\src\trunk\src\main\java\net\sf\oval\Validator.java:[373,58] addMethodParameterChecks(java.lang.reflect.Method,int,java.lang.Object) has private access in net.sf.oval.internal.ClassChecks
There exist multiple methods named addMethodParameterChecks in the class ClassChecks with different signatures. The problem is that javac tries to link against the wrong method when compiling the class calling one of the methods.
-
[Solved] WordPress 2.5 One-Click Plug-in Upgrades – Could not create directory
Some days ago I upgraded my WordPress installation to the new 2.5 release. Being a lazy guy I of course wanted to use the new on-click plug-in upgrades feature to update several plug-ins. Trying to one-click update some of the out-dated plug-ins only resulted in the rather meaningless error message “Could not create directory”. So I started searching the web for possible solutions. I quickly found some posts explaining this issue to be a directory permission problem. Manually creating the /wp-content/upgrade directory and chmoding it as well as the plug-in directories to 777 should solve the problem. Unfortunately not for me. Therefore I rolled up my sleeves and started to debug WordPress…
To cut a long story short, eventually I came across this PHP bug report #42739 mkdir doesn’t like a trailing slash when safe_mode is enabled and it turned out that this was the issue I was facing with on my hosting account too. The safe_mode option is enabled and WordPress tries to create directories that end with a slash (e.g. /htdocs/wp-content/upgrade/the-plugin/).
After knowing the reason I could develop a workaround and finally got the one-click updater running. If you are facing the same issue you can try to use my patch too.
- Locate and open the file <wp_root>/wp_admin/includes/class-wp-filesystem-direct.php in an editor
- Search for “function mkdir”
- Add the following statements to this method
function mkdir($path,$chmod=false,$chown=false,$chgrp=false){ if( ! $chmod) $chmod = $this->permission; // workaround for http://bugs.php.net/bug.php?id=42739 starts here if(ini_get('safe_mode') && substr($path, -1) == '/') { $path = substr($path, 0, -1); } // workaround for http://bugs.php.net/bug.php?id=42739 ends here if( !@mkdir($path,$chmod) ) return false; if( $chown ) $this->chown($path,$chown); if( $chgrp ) $this->chgrp($path,$chgrp); return true; } - Start one-click updating!
Addendum:
- The patch also works for WordPress 2.5.1
- If applying this patch does not lead to success the problem may have a second cause. Therefore also check the permissions on the /wp-content/upgrade/ folder and it’s sub folders, e.g. chmod them to 777. If the upgrade directory does not exist at all it may be sufficient to create it manually.
- Locate and open the file <wp_root>/wp_admin/includes/class-wp-filesystem-direct.php in an editor
-
MyPad v1.1.6 – a PHP Editor
MyPad is a very compact PHP Editor. I developed this editor because I could not find a suitable PHP Editor with a Single Document Interface.
The Editor I was searching for should look and behave like Notepad, but should be able to colorize PHP source code.
Such a small Editor can be perfectly used in conjunction with a norton commander like filemanager.


Looking for a high performer for your next IT project?

English
Deutsch
Recent Comments