phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

[BUG] Wrong interface on compileSource leads to fatal error #16608

Closed oleghind closed 5 months ago

oleghind commented 5 months ago

protected function compileSource(string! viewCode, bool extendsMode = false) -> string

compileSource method returns string, but sometimes it returns array

Example:

                    if extendsMode {
                        let finalCompilation[] = block;
                    } else {
                        let finalCompilation .= block;
                    }
                }
            }

            return finalCompilation;

... which leads to a crash: PHP Fatal error: Phalcon\Mvc\View\Engine\Volt\Compiler::compileSource(): Return value must be of type string, array returned

Better adjust interface to string | array

niden commented 5 months ago

Resolved in https://github.com/phalcon/cphalcon/pull/16609

Thank you @oleghind