Recent Topics

1 Aug 11, 2008 00:57    

Running getmail.php from cron and this error is thrown. Looks to me like a global var is not in context. But php and b2 is new to me.

PHP Fatal error: Call to a member function get_Group() on a non-object in /path-to-b2/inc/_core/_param.funcs.php on line 1617

---snip----

1611:global $current_User;
1612:
1613:switch( $context )
1614:{
1615: case 'posting':
1616: case 'xmlrpc_posting':
1617: $Group = & $current_User->get_Group();

2 Aug 11, 2008 01:32

The 'non-object' here is $current_User. It is called but most likely empty. I suppose you ran getmail.php without an email being present to be processed. Anyway this is a bug because this should be caught with a normal message "No email found" in stead of throwing an error.

3 Aug 11, 2008 02:39

There are mails in the mailbox. So something else is going on. If I run the check from Global Settings->Features then the posts end up on the blog.

How does $current_User get set when getmail.php is run from cron?
Does it extract that from the email?

4 Aug 11, 2008 04:13

The email should start with:

User:pass


With your login and password. That is the $current_User. The post will be assigned to that user as author.
So if everything is correct there should not be this error.

5 Aug 11, 2008 06:39

It works fine from the admin menu.
It won't work when getmail.php is run from cron.

I would expect that would be a clue, but I don't know enough about b2 to figure out where the chain of events is breaking down. My hunch is that it has to do with how that variable gets passed. A different code path perhaps.

6 Aug 12, 2008 17:54

Maybe someone can point me in the right direction? I just don't know enough about b2 yet to know where to start looking. Is it a config issue? i.e. a user level problem?

My compass needle is spinning around and have no idea which way to turn. (^: GPS signal no good either.

7 Aug 14, 2008 05:54

I'm learning some PHP. But in reverse, sort of....

I placed some fwrites and coupled with parsing over $GLOBALS and using print_r I was able to capture what "state" things were in when the cron job ran. I wrote the output to a file (it ended up in the cron/ dir)

So once _param.funcs.php ran I got lots of output into the log file.
(The log file was 240kB of GLOBALS)

current_User was empty, no big surprise.
[current_User] =>

Also in the globals were all the emails in the pop account. So everything looks fine except that current_User is not defined. How/where/when does that happen? I would guess it's derived from the email but that's not happening.

Feel free to chime in if you think you know what's going on. (^:

9 Aug 14, 2008 21:04

This diff allows for a ":" in the user_pass. Hope this is appropriate for this group. Apologies if it should go somewhere else.

--- getmail.1.php       2008-08-14 11:54:47.000000000 -0700
+++ getmail.php 2008-08-14 11:53:13.000000000 -0700
@@ -559,7 +559,8 @@
                        echo_message( T_( 'Message content:' ) . '<code>' . htmlspecialchars( $content ) . '</code>', INFO, 3, true );

                        $user_login = trim( $a_authentication[0] );
-                       $user_pass = @trim( $a_authentication[1] );
+                       $user_pass = substr( $a_body[0], ( strpos( $a_body[0], ':' ) + 1 ) );
+                       $user_pass = @trim($user_pass);

                        echo_message( T_( 'Authenticating user' ) . ': ' . $user_login, INFO, 3, true );
                        // authenticate user

10 Sep 30, 2008 14:59

I had gotten getmail.php working for my situation after first upgrading to 2.4.1....but evidently I never used the functionality again until recently....to find that it had stopped working. Not sure if it was 2.4.2 or 2.4.5 that broke it.

But, I got it working again....I changed $loop_User to $current_User

The Dreamer


Form is loading...