{"action":"closed","issue":{"url":"https://api.github.com/repos/mgp25/Chat-API/issues/733","labels_url":"https://api.github.com/repos/mgp25/Chat-API/issues/733/labels{/name}","comments_url":"https://api.github.com/repos/mgp25/Chat-API/issues/733/comments","events_url":"https://api.github.com/repos/mgp25/Chat-API/issues/733/events","html_url":"https://github.com/mgp25/Chat-API/issues/733","id":78221541,"number":733,"title":"\"getMediaFile updated\" commit issues","user":{"login":"ludufre","id":4112077,"avatar_url":"https://avatars.githubusercontent.com/u/4112077?v=3","gravatar_id":"","url":"https://api.github.com/users/ludufre","html_url":"https://github.com/ludufre","followers_url":"https://api.github.com/users/ludufre/followers","following_url":"https://api.github.com/users/ludufre/following{/other_user}","gists_url":"https://api.github.com/users/ludufre/gists{/gist_id}","starred_url":"https://api.github.com/users/ludufre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ludufre/subscriptions","organizations_url":"https://api.github.com/users/ludufre/orgs","repos_url":"https://api.github.com/users/ludufre/repos","events_url":"https://api.github.com/users/ludufre/events{/privacy}","received_events_url":"https://api.github.com/users/ludufre/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-19T19:30:54Z","updated_at":"2015-05-19T23:18:01Z","closed_at":"2015-05-19T23:18:01Z","body":"Hi!\r\n\r\nAfter update to the last commit (getMediaFile updated) I get the error while sending a image or video:\r\n\r\n```url\r\nhttp://s4.gamevicio.com/images/capas/7/7721.jpg\r\n```\r\n``` dos\r\nPHP Notice:  Undefined index: filesize in /var/www/ludufre/wpp/api/whatsprot.class.php on line 2425\r\n\r\nNotice: Undefined index: filesize in /var/www/ludufre/wpp/api/whatsprot.class.php on line 2425\r\nPHP Warning:  hash_file(/var/www/ludufre/wpp/api/wadata/media/WHAmiu3Q0): failed to open stream: No such file or directory in /var/www/ludufre/wpp/api/whatsprot.class.php on line 3673\r\n\r\nWarning: hash_file(/var/www/ludufre/wpp/api/wadata/media/WHAmiu3Q0): failed to open stream: No such file or directory in /var/www/ludufre/wpp/api/whatsprot.class.php on line 3673\r\ntx  <iq id=\"9\" to=\"s.whatsapp.net\" type=\"set\" xmlns=\"w:m\">\r\ntx    <media hash=\"\" type=\"image\" size=\"6094\"></media>\r\ntx  </iq>\r\n\r\nrx  <iq from=\"s.whatsapp.net\" id=\"9\" type=\"error\">\r\nrx    <error code=\"400\" text=\"bad-request\"></error>\r\nrx  </iq>\r\n```\r\n\r\nThe issues consists in two parts:\r\n\r\n1) `Undefined index: filesize`\r\n\r\nThe `$this->mediaFileInfo['filesize']` is compared with `$maxsizebytes` on line 2425. But the value of the firts variable is not set yet in the current context. Only on line 2532.\r\nSolution: Replaced line 2418 `$filesize   = strlen($image);` with `$this->mediaFileInfo['filesize'] = strlen($image);`\r\n\r\n2) The file is removed before send. So, I commented the line `unlink($this->mediaFileInfo['filepath']);` and solved.\r\n\r\nI'm ok on this or I missed something?\r\n\r\nP.s. I don't know how to suggest change directly in the code."}}