cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Problem with 1.2.1

Open timurbakarov opened this issue 13 years ago • 12 comments

I updated phalcon to version 1.2.1 and my app stop working. It shows no error, browser (Chrome) says "This webpage is not available" with the error Error code: ERR_CONNECTION_RESET.

App is multimodule. If I remove multi-module part then it works fine. So it seems the problem with Module class.

I tried on Windows, PHP 5.4.13 and FreeBSD 6.3, PHP 5.5.1

timurbakarov avatar Jul 24 '13 16:07 timurbakarov

Can you try compiling again from master?

ghost avatar Jul 24 '13 16:07 ghost

Unfortunately, no. Only on Windows.

timurbakarov avatar Jul 24 '13 16:07 timurbakarov

Could you please give us the code that causes the crash?

ghost avatar Jul 24 '13 17:07 ghost

$application->registerModules(
    array(
        'frontend' => array(
            'className' => 'Frontend\Module',
            'path'      => __DIR__.'/sites/frontend/Module.php',
        )
    )
);

And there is standart Module class in Module.php file with registerAutoloaders() and registerServices() methods. If I remove class definition from Module.php then it shows error "Module wasn't found in the dependency injection container."

namespace Frontend;

class Module implements \Phalcon\Mvc\ModuleDefinitionInterface
{
    /**
     * Register a specific autoloader for the module
     */
    public function registerAutoloaders()
    {
        $loader = new \Phalcon\Loader();

        $loader->registerNamespaces(
            array(
                'Frontend\Controllers'=>__DIR__.'/controllers/',
                'Frontend\Library'=>__DIR__.'/libraries/',
            )
        );

        $loader->register();
    }

    /**
     * Register specific services for the module
     */
    public function registerServices($di)
    {
        //Registering a dispatcher
        $di->set('dispatcher', function() {
            $dispatcher = new \Phalcon\Mvc\Dispatcher();
            $dispatcher->setDefaultNamespace("Frontend\Controllers");
            return $dispatcher;
        });

        $di->getShared('view')->setViewsDir(__DIR__.'/views/');

        /**
         * Elements
         */
        $di->set('elements', function(){
            return new Library\Elements;
        });
    }
}

timurbakarov avatar Jul 24 '13 17:07 timurbakarov

OK, this is the code I have: https://gist.github.com/sjinks/6076720

I run it: php index.php

This is what is displayed:

Frontend\Module::registerAutoloaders
Frontend\Module::registerServices
Frontend\Controllers\IndexController::indexAction

No crashes etc.

Could you please check whether my code works for you? If it works, then I still need the code to reproduce the bug.

ghost avatar Jul 25 '13 03:07 ghost

I found the problem. It was because of small error. If error occurs in controller or if write something like echo 'test'; exit; in controller, app crashes instead of showing error or stoping. Any guess why it does?

timurbakarov avatar Jul 25 '13 10:07 timurbakarov

I can confirm this. exit; or die; inside controller crashes the Apache on windows with Phalcon 1.2.1.

Apache log entry [Thu Jul 25 16:05:17.354466 2013] [mpm_winnt:notice] [pid 3836:tid 200] AH00428: Parent: child process 4252 exited with status 3221225477 -- Restarting.

iforp avatar Jul 25 '13 11:07 iforp

If you run it from the console, does it show something like

php: cphalcon/ext/phalcon.c:685: zm_shutdown_phalcon: Assertion `(((zend_phalcon_globals *) (*((void ***) tsrm_ls))[((phalcon_globals_id)-1)])->start_memory) == ((void *)0)' failed.

:question:

ghost avatar Jul 25 '13 14:07 ghost

I fixed this in master yesterday, DLLs are now available

ghost avatar Jul 25 '13 14:07 ghost

Yes, with new DLL it's Ok

iforp avatar Jul 25 '13 14:07 iforp

It's ok. But there's another problem with session. It cause the crash with no error. Should I create another issue about it?

timurbakarov avatar Jul 25 '13 19:07 timurbakarov

Yes please and try to offer as much information possible so that we can address it :)

On Thu, Jul 25, 2013 at 3:25 PM, Timur Bakarov [email protected]:

It's ok. But there's another problem with session. It cause the crash with no error. Should I create another issue about it?

— Reply to this email directly or view it on GitHubhttps://github.com/phalcon/cphalcon/issues/909#issuecomment-21578308 .

niden avatar Jul 25 '13 19:07 niden