-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[HttpKernel] Do not enable HtmlDumper if the request is issued by curl #13915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\DebugBundle; | ||
|
||
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage as BaseExpressionLanguage; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason for not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no good reason There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch ;) |
||
|
||
/** | ||
* Adds some functions to the default Symfony Debug ExpressionLanguage. | ||
* | ||
* @author Grégoire Pineau <lyrixx@lyrixx.info> | ||
*/ | ||
class ExpressionLanguage extends BaseExpressionLanguage | ||
{ | ||
protected function registerFunctions() | ||
{ | ||
parent::registerFunctions(); | ||
$this->register('strpos', function ($haystack, $needle) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should a function provider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure to understand. Can you give me more details? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Symfony 2.6, we introduce a function provider in the ExpressionLanguage component, and it should be used. See https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php and https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php for the usage in the security component. |
||
return sprintf('strpos(%s, %s)', $haystack, $needle); | ||
}, function (array $variables, $haystack, $needle) { | ||
return strpos($haystack, $needle); | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use
"0 === strpos(request.headers.get('user-agent'), 'curl/')"
as default value ?