Teppy Posted July 16, 2021 Posted July 16, 2021 I'm trying to use the Auto Updater, specifically the update.php to dynamically generate metadata according to this documentation: https://docs.freemmorpgmaker.com/en-US/deploy/autoupdater.html#uploading  I keep getting the following error through the client went trying to auto update.  [16-Jul-2021 03:47:49 UTC] PHP Warning:  Creating default object from empty value in /home/public_html/updater/update.php on line 72  Has anyone else had this issue? Any ideas on how to fix it?
0 jcsnider Posted July 16, 2021 Posted July 16, 2021 Please provide a url to your update.php.  The log above is just a warning and big an issue.Â
0 Cheshire Posted July 16, 2021 Posted July 16, 2021 I remember this from the discord where you got a 403, which means it's likely something related to security or hotlinking on your webhost.
0 jcsnider Posted July 16, 2021 Posted July 16, 2021 (edited) That link doesn't work. It should provide a long list of files, sizes, hashes, etc. The link might be wrong. Or the host might not support php or any other host of issues. Regardless it's not an Intersect problem. Edited July 16, 2021 by jcsnider
0 Teppy Posted July 16, 2021 Author Posted July 16, 2021 4 hours ago, jcsnider said: That link doesn't work. It should provide a long list of files, sizes, hashes, etc. The link might be wrong. Or the host might not support php or any other host of issues. Regardless it's not an Intersect problem.  Sorry about that can you check it again? I had messed with switching hosts last night and forgot to switch it back. It does provide that list but still 403 error on the client when pointing to the update.php
0 jcsnider Posted July 16, 2021 Posted July 16, 2021 So first off.. you need to make a "resources" folder inside the updater folder, and put everything in there except for the update.php file, the .exes, and the .pdbs.  So the file tree looks something like:  updater/  update.php  Intersect Client.exe  Intersect Client.pdb  Intersect Editor.exe  Intersect Editor.pdb  resources/    animations    items    gui    packs    etc   Secondly, check and see if there is a file called error_log inside your /updater folder. The update.php script sees one, but that might be something hidden/inaccessible that your host has. Worldofjimmy 1
0 Teppy Posted July 16, 2021 Author Posted July 16, 2021 After moving things around to be organized as above now I get this: Â [Update Check Failed!] - Unexpected character encountered while parsing value: <. Path ",line 0, position 0.
0 jcsnider Posted July 16, 2021 Posted July 16, 2021 It's much closer now. I need to update the php script to ignore files with no extension or files that start with .  I'm gonna be out for the evening so may send something over tomorrow unless someone beats me to it.Â
0 Teppy Posted July 16, 2021 Author Posted July 16, 2021 Awesome, thanks jcsnider! If I had any idea how to do it I would
0 jcsnider Posted July 17, 2021 Posted July 17, 2021 Replace your update.php with this.. it might not completely solve it, but we will be one step closer. https://www.ascensiongamedev.com/resources/filehost/37bd77956787e4bacbd87063f880744b.zip
0 Habib Posted August 11, 2021 Posted August 11, 2021 On 7/17/2021 at 10:31 AM, jcsnider said: Replace your update.php with this.. it might not completely solve it, but we will be one step closer. https://www.ascensiongamedev.com/resources/filehost/37bd77956787e4bacbd87063f880744b.zip Still doesn't work for me, same error!
0 XFallSeane Posted August 11, 2021 Posted August 11, 2021 10 hours ago, Habib said: Still doesn't work for me, same error!  If u have same error add this in top of your update.php after < ?php  ini_set('display_errors', 0); Habib 1
0 Habib Posted August 11, 2021 Posted August 11, 2021 46 minutes ago, XFallSeane said:  If u have same error add this in top of your update.php after < ?php  ini_set('display_errors', 0); Sadly, the error still up... I have added that line of code just after < ?php , as you said, but the error's still there. Thanks for trying, tho. If you have any other thoughts in your mind, please don't be affraid to share xD
0 XFallSeane Posted August 12, 2021 Posted August 12, 2021 8 hours ago, Habib said: Sadly, the error still up... I have added that line of code just after < ?php , as you said, but the error's still there. Thanks for trying, tho. If you have any other thoughts in your mind, please don't be affraid to share xD   Can you share your update url ?Â
0 Habib Posted August 12, 2021 Posted August 12, 2021 8 hours ago, XFallSeane said:   Can you share your update url ? https://www.ascensiongamedev.com/resources/filehost/7591c6277ab9aa60c833f80e20a63333.rar  There's my update.php file!
0 XFallSeane Posted August 12, 2021 Posted August 12, 2021 1 hour ago, Habib said: https://www.ascensiongamedev.com/resources/filehost/7591c6277ab9aa60c833f80e20a63333.rar  There's my update.php file!  Not work have you link from your website ?
0 Habib Posted August 12, 2021 Posted August 12, 2021 3 minutes ago, XFallSeane said: Â Not work have you link from your website ? I can't share my website link for now since it's include another project that I'm not available to public share... Here's update.php: <?php ini_set('display_errors', 0); function scanD($target, $obj) { $excludeFiles = array("resources/mapcache.db", "update.json", "version.json"); $clientExcludeFiles = array("Intersect Editor.exe", "Intersect Editor.pdb"); $excludeDirectories = array("logs", "screenshots"); $excludeExtensions = array(".dll", ".xml", ".config", ".php"); if(is_dir($target)){ $skipDir = false; $dir = str_replace(getcwd() . "/", "", $target); foreach ($excludeDirectories as $excludeDir) { if (endsWith($dir, $excludeDir . "/")) { $skipDir = true; break; } } if ($skipDir == false) { $files = glob( $target . '*', GLOB_MARK ); //GLOB_MARK adds a slash to directories returned foreach( $files as $file ) { scanD( $file, $obj ); $skip = is_dir($file); foreach ($excludeExtensions as $extension) { if (endsWith($file, $extension)) { $skip = true; break; } } $path = str_replace(getcwd() . "/", "", $file); if (in_array($path, $excludeFiles)) { $skip = true; } if (strpos($path, ".") == false) { $skip = true; } if ($skip == false) { if (in_array($path,$clientExcludeFiles)) { $obj->Files[] = array("Path"=>$path, "Hash"=>md5_file($file), "Size"=>filesize($file), "ClientIgnore"=>true); } else { $obj->Files[] = array("Path"=>$path, "Hash"=>md5_file($file), "Size"=>filesize($file)); } } } } } } function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } $path = getcwd(); $obj->TrustCache = true; if (file_exists("stream.php")) { $obj->StreamingUrl = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1) . "stream.php"; } $obj->Files = []; scanD($path, $obj); echo json_encode($obj, JSON_UNESCAPED_SLASHES); ?> Â
Question
Teppy
I'm trying to use the Auto Updater, specifically the update.php to dynamically generate metadata according to this documentation:Â https://docs.freemmorpgmaker.com/en-US/deploy/autoupdater.html#uploading
Â
I keep getting the following error through the client went trying to auto update.
Â
[16-Jul-2021 03:47:49 UTC] PHP Warning: Â Creating default object from empty value in /home/public_html/updater/update.php on line 72
Â
Has anyone else had this issue? Any ideas on how to fix it?
18 answers to this question
Recommended Posts