php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76217 Yaf_Dispatcher::setDefault* memory leaks
Submitted: 2018-04-13 11:09 UTC Modified: -
From: fanjiapeng at 126 dot com Assigned:
Status: Open Package: yaf (PECL)
PHP Version: 7.2.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fanjiapeng at 126 dot com
New email:
PHP Version: OS:

 

 [2018-04-13 11:09 UTC] fanjiapeng at 126 dot com
Description:
------------
Involves three methods, Yaf_Dispatcher::setDefaultModule, Yaf_Dispatcher::setDefaultController, Yaf_Dispatcher::setDefaultAction

Test script:
---------------
/* Bootstrap.php */
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
    public function _initConfig(Yaf_Dispatcher $dispatcher)
    {
        $dispatcher->setDefaultModule("index")
            ->setDefaultController("admin")->setDefaultAction("login");
    }
}

/* index.php */
<?php
$config = array(
    "application" => array(
        "directory" => realpath(dirname(__FILE__)) . "/application/",
        "modules" => "Index,User,Admin",
    ),
);

$app = new Yaf_Application($config);
$app->bootstrap()->run();

/* /www/application/controllers/Admin.php */
<?php
class AdminController extends Yaf_Controller_Abstract
{
    public function loginAction()
    {
        echo "index::admin::login", PHP_EOL;
        return false;
    }
}

Expected result:
----------------
index::admin::login

Actual result:
--------------
index::admin::login
[Fri Apr 13 19:00:40 2018]  Script:  '/www/index.php'
/usr/local/php/php-7.2.4/Zend/zend_operators.c(2548) :  Freeing 0x000000010c604028 (6 bytes), script=/www/index.php
Last leak repeated 2 times
[Fri Apr 13 19:00:40 2018]  Script:  '/www/index.php'
/usr/local/php/include/php/Zend/zend_string.h(134) :  Freeing 0x000000010c66fb80 (32 bytes), script=/www/index.php
=== Total 4 memory leaks detected ===

Patches

yaf_dispatcher_setDefault.patch (last revision 2018-04-13 11:10 UTC by fanjiapeng at 126 dot com)

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Dec 17 05:01:26 2018 UTC