Client Deleted Fileset Resulted in Call of Function on Non-Object

Permalink Browser Info Environment
Hey guys. Thank you for putting this block out for everyone... it has come in handy many times.

I wanted to suggest a minor fix for future versions. I passed a completed site on to a client and almost immediately got a call that they had broken the site. Turns out they deleted the fileset that was already in place on one of the pages already created (and in fact it was set up on the page-type output making that inaccessible as well). In tinkering I added a check to see if $fs was an object and it solved all issues. The change though is in the controller and I fear that if the package is ever updated, my change will go bye bye.

Anyway. Just a suggestion.
Cheers,
C

function view(){
        $fsID = $this->fileset;
        $bID = $this->bID;
        $db = Loader::db();
        $existingThumbs = $db->GetAll('SELECT * from btVividThumbGalleryThumb WHERE bID = ? ORDER BY sort', array($bID)); //gives us all the files we've already saved/sorted
        $existingThumbIDs = array();
        foreach($existingThumbs as $thumb){
            $existingThumbIDs[] = $thumb['fID'];
        }
        $fs = FileSet::getByID($fsID);
      if (is_object($fs)) {
         $fileList = new FileList();            
         $fileList->filterBySet($fs);
         $fileList->filterByType(FileType::T_IMAGE);
         $fileList->sortByFileSetDisplayOrder();

Type: Discussion
Status: New
Chrouglas
View Replies:

concrete5 Environment Information

# concrete5 Version
Core Version - 8.4.3
Version Installed - 8.4.3
Database Version - 20180716000000

# concrete5 Packages
Thumb Gallery (1.0.3)

# concrete5 Overrides
blocks/page_list/templates/thumbnail_grid2/view.css, blocks/page_list/templates/thumbnail_grid2/view.php, blocks/page_list/templates/thumbnail_grid2, blocks/page_list/templates, blocks/page_list, blocks/vivid_thumb_gallery/templates/masonry/view.css, blocks/vivid_thumb_gallery/templates/masonry/view.php, blocks/vivid_thumb_gallery/templates/masonry, blocks/vivid_thumb_gallery/templates, blocks/vivid_thumb_gallery/form.php, blocks/vivid_thumb_gallery/assets/imagelightbox.min.js, blocks/vivid_thumb_gallery/assets/elevateZoom.js, blocks/vivid_thumb_gallery/assets, blocks/vivid_thumb_gallery, blocks/testimonial/view.css, blocks/testimonial/view.php, blocks/testimonial, blocks/staff_block/db.xml, blocks/staff_block/add.php, blocks/staff_block/controller.php, blocks/staff_block/view.css, blocks/staff_block/form_setup_html.php, blocks/staff_block/edit.php, blocks/staff_block/view.php, blocks/staff_block, blocks/autonav/templates/responsive_header_navigation/view.php, blocks/autonav/templates/responsive_header_navigation, blocks/autonav/templates, blocks/autonav/view.php, blocks/autonav, blocks/feature/templates/cta/view.php, blocks/feature/templates/cta, blocks/feature/templates, blocks/feature/view.js, blocks/feature/view.php, blocks/feature, blocks/image/templates/fullscreen/view.css, blocks/image/templates/fullscreen/view.php, blocks/image/templates/fullscreen, blocks/image/templates, blocks/image, themes/obar/page_theme.php, themes/obar/full.php, themes/obar/description.txt, themes/obar/default.php, themes/obar/img/concretelogin.png, themes/obar/img, themes/obar/homepage.php, themes/obar/css/bootstrap-modified.css, themes/obar/css/styles.css, themes/obar/css/styles_edit.css, themes/obar/css/styles_reset.css, themes/obar/css, themes/obar/inc/footerhtml.php, themes/obar/inc/headerhtml.php, themes/obar/inc/footer.php, themes/obar/inc/script_incs.php, themes/obar/inc/header.php, themes/obar/inc, themes/obar/scripts/scripts.js, themes/obar/scripts, themes/obar/thumbnail.png, themes/obar/view.php, themes/obar

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.6.38

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, mysql, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, redis, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 265M
post_max_size - 16M
sql.safe_mode - Off
upload_max_filesize - 16M
ldap.max_links - Unlimited
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 2000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:63.0) Gecko/20100101 Firefox/63.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.