eZ Community » Forums » Developer » eZPublish4 : Module +...
expandshrink

eZPublish4 : Module + header('Location:') + exit

eZPublish4 : Module + header('Location:') + exit

Thursday 28 November 2013 3:52:17 pm

Dear All,

I need to develop a module that will load an external library is a redirection.

Only this redirection is not 'clean' by eZ.

<?php
$Module = $Params['Module'];
$clientini = eZINI::instance('client.ini');
$simpleSAMLphp_path = $clientini->variable('simpleSAMLphp', 'path'); // /var/www/html/sites/client/simplesamlphp/
require_once $simpleSAMLphp_path.'lib/_autoload.php';
$saml_authsource = $clientini->variable('simpleSAMLphp', 'authsource'); // ezpublish-Client-SP
$auth = new SimpleSAML_Auth_Simple($saml_authsource);
 
if ( ! $auth->isAuthenticated() ) {
/**
 * Start an authentication process.
 *
 * This function never returns.
 *
 * This function accepts an array $params, which controls some parts of
 * the authentication. The accepted parameters depends on the authentication
 * source being used. Some parameters are generic:
 *  - 'ErrorURL': An URL that should receive errors from the authentication.
 *  - 'KeepPost': If the current request is a POST request, keep the POST
 *    data until after the authentication.
 *  - 'ReturnTo': The URL the user should be returned to after authentication.
 *  - 'ReturnCallback': The function we should call after the user has
 *    finished authentication.
 *
 * @param array $params  Various options to the authentication request.
 */
$auth->login();
} else { /* ... */ }

The SimpleSAML_Auth_Simple login() function do:

 /* Set the location header. */
header('Location: ' . $url, TRUE, $code);
exit;

But eZ don't like header and exit ! 

Fatal error: The web server did not finish its request

Obviously, I can not change the code of the external library. (As would be too easy ...)

So What's the solution?

Modified on Thursday 28 November 2013 3:55:30 pm by Rémy PHP

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from