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

3.0.3 : Call to undefined method self::geturlservice() #12577

Closed gerard67 closed 7 years ago

gerard67 commented 7 years ago

with 3.0.3, I cannot load assets anymore. The relevant code in the view component is

<?php

use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\Micro;

error_reporting(E_ALL);

define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');

try {

    /**
     * The FactoryDefault Dependency Injector automatically registers the services that
     * provide a full stack framework. These default services can be overidden with custom ones.
     */

    $di = new \Phalcon\Di\FactoryDefault();
    $assets = $di->get('assets');
    $assets->addCss('test.css');
    \Phalcon\Di::setDefault($di);
    $assets->outputCss();

} catch (\Exception $e) {
    $response = new \Phalcon\Http\Response();
    $response->setStatusCode(500, "Internal Server Error");
    $response->setHeader("Content-Type", "text/html");
    // Set the content of the response
    $response->setContent($e->getMessage() . '<br><pre>' . $e->getTraceAsString() . '</pre>');
    $response->send();
}

I get the following error

Call to undefined method self::geturlservice(), did you mean 'undefined'?
#0 [internal function]: Phalcon\Tag::stylesheetLink('test.css', true)
#1 [internal function]: Phalcon\Assets\Manager->output(Object(Phalcon\Assets\Collection), Array, 'css')
#2 [...]sitemanager/public/index.php(22): Phalcon\Assets\Manager->outputCss()
#3 {main}

Same code is working fine with 3.0.0 : http://de58f740.eu.ngrok.io/plot/

Details

Jurigag commented 7 years ago
$di = new \Phalcon\Di\FactoryDefault();
$assets = $di->get('assets');
$assets->addCss('test.css');
\Phalcon\Di::setDefault($di);
$assets->outputCss();

Works for me

stamster commented 7 years ago

PHP Version: 7.1.1 ?! Not supported, how did you managed to use Phalcon 3.0.x with PHP 7.1.x at first place? You must have compiled Phalcon prior to upgrading PHP itself...

Jurigag commented 7 years ago

Maybe somehow on 7.1.1 it's working and not on 7.1.0 ?

stamster commented 7 years ago

That would be crazy, and they already broke API with 7.1 in general... not very good for the community in general.

gerard67 commented 7 years ago

Works with php 7.0.14. I'm closing the issue.