Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined variable: message in Argument.php line 54 #30

Closed
Treggats opened this issue Mar 24, 2017 · 6 comments
Closed

Undefined variable: message in Argument.php line 54 #30

Treggats opened this issue Mar 24, 2017 · 6 comments

Comments

@Treggats
Copy link

use case

When setting up a new Imap class like so:

$imap = new Eden('imap.gmail.com', 'john.doe@gmail.com', 'x-my-very-secret-password', '993', true);

and trying to fetch the mailboxes like so $imap->getMailboxes()
I get the following error message:

PHP error:  Undefined variable: message in (..laravel..)/vendor/eden/core/src/Argument.php on line 54

It seems to involve the following snippet

    /**
     * One of the hard thing about instantiating classes is
     * that design patterns can impose different ways of
     * instantiating a class. The word "new" is not flexible.
     * Authors of classes should be able to control how a class
     * is instantiated, while leaving others using the class
     * oblivious to it. All in all its one less thing to remember
     * for each class call. By default we instantiate classes with
     * this method.
     *
     * @param mixed[,mixed..] $args Arguments to pass to the constructor
     *
     * @return Eden\Core\Argument
     */
    public static function i()
    {
        $class = __CLASS__;
        return new $class($message, $code); // <-- this line
    }

I haven't found the solution yet, but it seems that $message is never set.

@Treggats
Copy link
Author

I sort of fixed this by removing the $message and $code arguments from the method.
Sort of hack, but on the short term I didn't see another fix.

@adin234
Copy link

adin234 commented Mar 27, 2017

$imap = eden('mail')->imap(
	'imap.gmail.com', 
	'your_email@gmail.com', 
	'[YOUR PASSWORD]', 
	993, 
	true);

@Treggats
Copy link
Author

@adin234 this is not a solution for me, I am using Laravel 5.3 and I can't use the helper there.
Your snippet was what I & my colleague first tried, but we couldn't get it to work in our application.
That is why the Imap class was directly called.

On a more personal note, if you just reply with a code snippet it suggests to me that you think I didn't research the issue properly. I am looking for support with my issue, replying with something I've already found in the documentation doesn't help.

Treggats pushed a commit to beeproger/Mail that referenced this issue Mar 27, 2017
@jcornide
Copy link

jcornide commented Jun 8, 2017

I have the same problem but using this library in Symfony

@avinash403
Copy link

I am facing the same problem while using it in laravel

@shahmir811
Copy link

Same problem using it with Laravel 5.4.
If I remove arguments from function i(), then I will get another error:

Call to undefined method Illuminate\Support\Facades\Mail::imap() ...

Will someone kindly help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants