Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

InvalidArgumentException

Comments in 'Plugin Development' started by Jelly9912, Nov 19, 2015.

  1. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Code:
    [Server] [19:46:33] [Server thread/WARNING]: InvalidArgumentException: "stream_get_contents() expects parameter 1 to be resource, null given" (E_WARNING) in "/SG/src/HG/profile/PSP" at line 37
    
    What does it mean?
  2. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Line 36 and 37
    PHP:
    $resource $this->getPlugIn ()->getResource $this::DB_SQL_FILE_STORY );
                
    $this->getPlugIn ()->database2->exec stream_get_contents $resource ) );
               
    Edit: This isn't my plugin but i need help
  3. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    It should be
    PHP:
    getPlugin()
    Jelly9912 likes this.
  4. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Still doesn't work, but thanks for help
  5. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    sorry, my post didn't update.
    You are receiving an error because you didn't provide any max length or off-set (I can be wrong, as I never intended to use it before)
    As, I am unsure, what you are trying to achieve, you should have a look at:

    http://php.net/manual/en/function.stream-get-contents.php


    Please like, if I helped :)
    Last edited: Nov 20, 2015
  6. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Simply put, you didn't provide a streamable argument for stream_get_contents(). Whatever $resource is currently returning (nothing) cannot be read by stream_get_contents(). Try to fopen() the file.
    You didn't point out the right error. Arguments maxlength and offset is not required, the only argument mandatory is the resource argument.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $this::DB_SQL_FILE_STORY isn't a valid filename in the resources folder. Try var_dump()'ing its value.
    And it is odd. Why would you use $this::CONST_NAME? Why not self::CONST_NAME?
    HotFireyDeath likes this.
  8. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    @PEMapModder

    I'll try

Share This Page

Advertisement