Fatal Catchable error in qtranslate_core.php
-
Hello, plugin developer.
Your latest version of the plugin sucks, to say the least.
There are 2 problems I’ve found so far:
1) file: qtranslate_configuration.php
Undefined index pl on line 621 or so. The line at fault is this:
<td><img src="<?php echo trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$lang]; ?>" alt="<?php echo $language; ?> Flag"></td>
where [$lang] will equal ‘pl’ it will not work because your $q_config[‘flag’] does not contain such an entry…
You can easily fix this kind of stupid errors, by checking if the entry exists, before requesting it:
<?php if(isset($q_config['flag'][$lang])){ ?> <tr> <td><img src="<?php echo trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$lang]; ?>" alt="<?php echo $language; ?> Flag"></td> <td><?php echo $language; ?></td> <td><?php if(in_array($lang,$q_config['enabled_languages'])) { ?><a class="edit" href="<?php echo $clean_uri; ?>&disable=<?php echo $lang; ?>"><?php _e('Disable', 'qtranslate'); ?></a><?php } else { ?><a class="edit" href="<?php echo $clean_uri; ?>&enable=<?php echo $lang; ?>"><?php _e('Enable', 'qtranslate'); ?></a><?php } ?></td> <td><a class="edit" href="<?php echo $clean_uri; ?>&edit=<?php echo $lang; ?>"><?php _e('Edit', 'qtranslate'); ?></a></td> <td><?php if($q_config['default_language']==$lang) { ?><?php _e('Default', 'qtranslate'); ?><?php } else { ?><a class="delete" href="<?php echo $clean_uri; ?>&delete=<?php echo $lang; ?>"><?php _e('Delete', 'qtranslate'); ?></a><?php } ?></td> </tr> <?php } ?>
2) The biggest problem was on line 455 in the qtranslate_core.php file, where you are trying to echo an instance of WP_Post class as string… ARE YOU FOR REAL???
Anyhow… there is a fix for that too: replace this:
return $before.strftime($format, $date).$after;
with this:
if($before instanceof WP_Post){ $before = $before->post_content; } if($format instanceof WP_Post){ $format = $format->post_date; } if($after instanceof WP_Post){ $after = $after->post_content; } return $before.strftime($format, $date).$after;
Are you even testing this plugin before releasing it???
- The topic ‘Fatal Catchable error in qtranslate_core.php’ is closed to new replies.