Skip to content

Instantly share code, notes, and snippets.

@sevein
Created November 9, 2011 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevein/1353203 to your computer and use it in GitHub Desktop.
Save sevein/1353203 to your computer and use it in GitHub Desktop.
Workaround for qubit 1.2 to fix app error when 404 is shown
Index: apps/qubit/config/routing.yml
===================================================================
--- apps/qubit/config/routing.yml (revision 10293)
+++ apps/qubit/config/routing.yml (working copy)
@@ -15,7 +15,6 @@
param:
module: qtSwordPlugin
slug: { pattern: '[^;]+' }
- throw404: false
sword:
url: /sword/:action
Index: apps/qubit/modules/staticpage/actions/indexAction.class.php
===================================================================
--- apps/qubit/modules/staticpage/actions/indexAction.class.php (revision 10293)
+++ apps/qubit/modules/staticpage/actions/indexAction.class.php (working copy)
@@ -23,6 +23,15 @@
{
$this->resource = $this->getRoute()->resource;
+ // HACK/TODO: this makes more sense to be part of
+ // lib/QubitResourceRoute.class.php but it is not working
+ // because the execution is very early in the process
+ // and $sf_user is not available for layout.php, so it fails
+ if (!isset($this->resource))
+ {
+ throw new sfError404Exception;
+ }
+
if (1 > strlen($title = $this->resource->__toString()))
{
$title = $this->context->i18n->__('Untitled');
Index: lib/QubitResourceRoute.class.php
===================================================================
--- lib/QubitResourceRoute.class.php (revision 10293)
+++ lib/QubitResourceRoute.class.php (working copy)
@@ -26,10 +26,13 @@
$criteria->addJoin(QubitSlug::OBJECT_ID, QubitObject::ID);
$this->resource = QubitObject::get($criteria)->__get(0);
- if (@$params['throw404'] == false && !isset($this->resource))
+
+ /* See apps/qubit/modules/staticpage/actions/indexAction.class.php
+ if (!isset($this->resource))
{
- throw new sfError404Exception;
+ // throw new sfError404Exception;
}
+ */
return parent::bind($context, $params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment