custom-post-type-ui icon indicating copy to clipboard operation
custom-post-type-ui copied to clipboard

Errors in every upgrade for a while

Open supercleanse opened this issue 11 years ago • 1 comments

So I get this every time I upgrade:

http://cspf.co/dnW7

I end up having to alter the code every time ... Starting on line 280 in version 1.1.2:

    $rewrite = get_disp_boolean( $taxonomy['rewrite'] );
    if ( false !== get_disp_boolean( $taxonomy['rewrite'] ) ) {
        $rewrite = array();
        $rewrite['slug'] = ( !empty( $taxonomy['rewrite_slug'] ) ) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
        if(isset($taxonomy['rewrite_withfront'])) {
            $rewrite['with_front'] = ( 'false' === disp_boolean( $taxonomy['rewrite_withfront'] ) ) ? false : true;
        }
        else {
            $rewrite['with_front'] = false;
        }

        if(isset($taxonomy['rewrite_hierarchical'])) {
            $rewrite['hierarchical'] = ( 'true' === disp_boolean( $taxonomy['rewrite_hierarchical'] ) ) ? true : false;
        }
        else {
            $rewrite['hierarchical'] = false;
        }
    }

I'm not sure if the default of false is accurate here or what's going on with the new release but this seems to fix things for me ... and at the very least it would be great if these errors didn't crop up next time I upgrade :) ... Thanks!

supercleanse avatar Nov 12 '15 23:11 supercleanse

See: https://github.com/WebDevStudios/custom-post-type-ui/issues/275#issuecomment-99904473

Essentially the OLD settings were using string '0' and '1' for their boolean values, and string '0' evaluates to true when used with php's empty(). I tried using empty() to prevent the notices, but that actually ended up causing new issues for other users. So...I resigned to letting them show through until everyone is moved off the pre-1.0.0 saved settings. I do a full string "true" and "false" in the newest settings setup. Neither end up evaluating to empty once available in the setting.

tw2113 avatar Nov 13 '15 00:11 tw2113