Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php 8.1 compatibility with method _addStringAsSVGImage() #274

Open
schplurtz opened this issue Jun 30, 2022 · 0 comments
Open

php 8.1 compatibility with method _addStringAsSVGImage() #274

schplurtz opened this issue Jun 30, 2022 · 0 comments

Comments

@schplurtz
Copy link
Contributor

Hi,

As DW Igor is approaching, I try the a2s plugin with Igor RC 2 and PHP 8.1

When I want to export to odt a DW page with an SVG image made by a2s, it fails. with Error: Non-static method ODTImage::addStringAsSVGImage() cannot be called statically error.

Is it me who is not using the right method in the a2s renderer, or is this a bug in the odt plugin ?

Just below, the error stack trace and the code I use in the a2s plugin.

2022-06-30 06:00:12Error: Non-static method ODTImage::addStringAsSVGImage() cannot be called statically /opt/www/she1dai1ohth1weej/lib/plugins/odt/ODT/ODTDocument.php(1610)
    #0 /opt/www/she1dai1ohth1weej/lib/plugins/odt/renderer/page.php(1608): ODTDocument->addStringAsSVGImage()
    #1 /opt/www/she1dai1ohth1weej/lib/plugins/a2s/syntax.php(181): renderer_plugin_odt_page->_addStringAsSVGImage()
    #2 /opt/www/she1dai1ohth1weej/lib/plugins/a2s/syntax.php(141): syntax_plugin_a2s->_render_odt()
    #3 /opt/www/she1dai1ohth1weej/inc/parser/renderer.php(117): syntax_plugin_a2s->render()
    #4 /opt/www/she1dai1ohth1weej/inc/parserutils.php(682): Doku_Renderer->plugin()
    #5 /opt/www/she1dai1ohth1weej/inc/parserutils.php(149): p_render()
    #6 /opt/www/she1dai1ohth1weej/inc/Action/Export.php(88): p_cached_output()
    #7 /opt/www/she1dai1ohth1weej/inc/ActionRouter.php(83): dokuwiki\Action\Export->preProcess()
    #8 /opt/www/she1dai1ohth1weej/inc/ActionRouter.php(48): dokuwiki\ActionRouter->setupAction()
    #9 /opt/www/she1dai1ohth1weej/inc/ActionRouter.php(60): dokuwiki\ActionRouter->__construct()
    #10 /opt/www/she1dai1ohth1weej/inc/actions.php(16): dokuwiki\ActionRouter::getInstance()
    #11 /opt/www/she1dai1ohth1weej/doku.php(126): act_dispatch()
    #12 {main}

    /**
     * Render odt output.
     *
     * @param Doku_Renderer  $renderer  The renderer
     * @param int            $state     The state
     * @param string         $txtdata   Textual data that handle() associated with this state
     * @param string         $align     img align
     * @return bool If rendering was successful.
     */
    protected function _render_odt(Doku_Renderer $renderer, $state, $txtdata, $align) {
        if($state === DOKU_LEXER_UNMATCHED) {
            $dim=$this->_extract_XY_4svg( $txtdata );
            $renderer->_addStringAsSVGImage(self::$opening.$txtdata, $dim[0], $dim[1], $align);
        }
        return true;
    }
eduardomozart added a commit to eduardomozart/dokuwiki-plugin-odt that referenced this issue May 10, 2023
Fixes message "Error: Non-static method ODTImage::addStringAsSVGImage() cannot be called statically" on PHP 8.1 as can be seen in lpaulsen93#274
It's also used by other plug-ins like switchpanel - https://github.com/GreenItSolutions/dokuwiki-plugin-switchpanel/blob/561d049aef21afb3d54406d1b62373e8275ce766/syntax.php#L460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant