WordPress.org

Ready to get started?Download WordPress

Forums

BUG - non-object in wp-settings.php on line 216 (4 posts)

  1. gazouteast
    Member
    Posted 5 years ago #

    BUG REPORT

    I have a fully working 2.6.3 installation - apart from the flash uploader everything is fine.

    On the site homepage I have a simple html/php page, part of which pulls the latest posts and comments from the blog using the standard calls -

    `require_once('./blog/wp-blog-header.php');
    <?php query_posts('showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php endwhile;?>`

    I've tried to use effectively the same code to pull the same info into the side bar of an SMF forum installation placed at a peer level in the heirarchy (SMF v1.1.7 (latest)) and keep getting the following error

    Fatal error: Call to a member function set_prefix() on a non-object in /home/server-user/public_html/blog/wp-settings.php on line 216

    Line 216 of wp-settings.php is -

    if ( !defined('WP_LANG_DIR') ) {
    plus another 20 lines setting the language directory path

    There is NO language directory in default English installs (in either /wp-content/ or in /wp-includes/) and THAT is what is causing the error call.

    Even after I added empty /languages/ folders to those paths, the error persisted.

    It is going to persist as long as there in no en.mo file in those folders.

    (And more importantly to me - no BRITISH English .mo file in there - British typography requires 2 :nbsp; after a full stop (only women have periods) and one :nbsp; after a comma (a Commer is an old make of British light van) - like wot I use when posting in the forums ;) )

    Gaz

  2. oranfry
    Member
    Posted 5 years ago #

    I had this problem in 2.7.1. The problem is that wordpress uses global variables, but if you include wp-blog-header.php from within a function then it stores to local variables instead, causing big problems. The workaround is to use the php 'global' keyword to bring all the require global variables into the function scope, and change some assignments in wp-settings.php:

    1. At the top of wp-blog-header.php (after <?php line), add a statement to bring all the relevant global variables. Here is what I am using:
      global $domain, $path, $base, $admin_page_hooks, $ajax_results, $all_links, $allowedposttags, $allowedtags, $authordata, $bgcolor, $cache_categories, $cache_lastcommentmodified, $cache_lastpostdate, $cache_lastpostmodified, $cache_userdata, $category_cache, $class, $comment, $comment_cache, $comment_count_cache, $commentdata, $current_user, $day, $debug, $descriptions, $error, $feeds, $id, $is_apache, $is_IIS, $is_macIE, $is_winIE, $l10n, $locale, $link, $m, $map, $max_num_pages, $menu, $mode, $month, $month_abbrev, $monthnum, $more, $multipage, $names, $newday, $numpages, $page, $page_cache, $paged, $pagenow, $pages, $parent_file, $preview, $previousday, $previousweekday, $plugin_page, $post, $post_cache, $post_default_category, $post_default_title, $post_meta_cache, $postc, $postdata, $posts, $posts_per_page, $previousday, $request, $result, $richedit, $single, $submenu, $table_prefix, $targets, $timedifference, $timestart, $timeend, $updated_timestamp, $urls, $user_ID, $user_email, $user_identity, $user_level, $user_login, $user_pass_md5, $user_url, $weekday, $weekday_abbrev, $weekday_initial, $withcomments, $wp, $wp_broken_themes, $wp_db_version, $wp_did_header, $wp_did_template_redirect, $wp_file_description, $wp_filter, $wp_importers, $wp_plugins, $wp_taxonomies, $wp_the_query, $wp_themes, $wp_object_cache, $wp_query, $wp_queries, $wp_rewrite, $wp_roles, $wp_similiesreplace, $wp_smiliessearch, $wp_version, $wpcommentspopupfile, $wpcommentsjavascript, $wpdb;
    2. In wp-settings.php, replace all occurences of '=&' with '='.

    - Oran @ Arigora

  3. philnelson
    Member
    Posted 5 years ago #

    Anything else on this? I've run into this problem as well, in trying to include WP functions in an outside script.

  4. philnelson
    Member
    Posted 5 years ago #

    Damned if this didn't work. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic