我目前面臨以下問題:請求的發佈數據似乎在某些時候被清除。在處理請求時丟失了變量變量
現狀:
在SF2應用,我在 「/ foo」 的自定義表單。它張貼2個屬性:{"sort":"sort","property":"barcode"}
問題:
應該處理這個工作得很好的開發ENV,但在PROD環境不工作的控制器。調查顯示,這是由於缺乏發佈數據。因此,我根據以下thread做了2種日誌方法。
1)通過內核監聽器登錄。 我有一個Library::logtxt('text')
函數,每次調用時在日誌文件中寫入一行'text'。我把它放在處理請求的控制器中。
,我有以下方法:
public function onKernelRequest(GetResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
// don't do anything if it's not the master request
return;
}
//this is master request: do something.
Library::logtxt('($post: '.json_encode($_POST).')');
}
與app_dev.php和app.php分別調用它,我得到: 日誌從網絡/ app_dev.php:
16:42:28 - Acme\DemoBundle\RequestListener:
($post: {"sort":"sort","property":"barcode"})
--------------------------------------------
16:42:28 - Acme\DemoBundle\Controller\FooController:
fooControllerAction called ($post: {"sort":"sort","property":"barcode"})
日誌從網絡/ app.php:
16:42:28 - Acme\DemoBundle\RequestListener:
($post: [])
--------------------------------------------
16:42:28 - Acme\DemoBundle\Controller\FooController:
fooControllerAction called ($post: [])
2)要確保發佈的數據確實發送了,但我在web/app.php中的Library :: logtxt(')記錄器。我得到: app.php:
16:44:07 - :
in app.php ($post: {"sort":"sort","property":"barcode"})
--------------------------------------------
16:44:07 - :
in app.php ($post: [])
--------------------------------------------
16:44:07 - Acme\DemoBundle\Controller\FooController:
fooControllerAction called ($post: [])
--------------------------------------------
解決方案
這一切似乎表明,事情發生在生產中是 「破壞」 公佈的數據。有人會知道這裏有什麼危險嗎?
編輯: 區別似乎du到config_dev.yml。
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
當這是評論app_dev.php得到擰app.php相同的方式。如果沒有,app_dev.php工程...
非常感謝提前爲照顧
問候,
EDITS:
應用程序/配置/ routing.yml中
hwi_oauth_security:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
#FOS :
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
google_login:
pattern: /login/check-google
acme_user:
resource: "@AcmeUserBundle/Resources/config/routing.yml"
prefix: /
acme_a:
resource: "@AcmeABundle/Resources/config/routing.yml"
prefix: /
acme_another:
resource: "@AcmeAnotherBundle/Resources/config/routing.yml"
prefix: /another/
app/config/routing_dev。陽明:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_console:
resource: "@CoreSphereConsoleBundle/Resources/config/routing.yml"
prefix: /_console
_main:
resource: routing.yml
不幸的是。 request-> post:[]。這似乎是綁定到config_dev中的'框架'設置。如果我評論它,app_dev.php不再工作... – Wisebes