fix php 5.6 in docker dev env (#1740)
[openemr.git] / vendor / zendframework / zend-escaper / doc / book / intro.md
blob0820456290472b8b7effb54faf38d5e5029ce810
1 # Introduction
3 The [OWASP Top 10 web security risks](https://www.owasp.org/index.php/Top_10_2010-Main)
4 study lists Cross-Site Scripting (XSS) in second place. PHP's sole functionality
5 against XSS is limited to two functions of which one is commonly misapplied.
6 Thus, the zend-escaper component was written. It offers developers a way to
7 escape output and defend from XSS and related vulnerabilities by introducing
8 **contextual escaping based on peer-reviewed rules**.
10 zend-escaper was written with ease of use in mind, so it can be used completely stand-alone from
11 the rest of the framework, and as such can be installed with Composer:
13 ```bash
14 $ composer install zendframework/zend-escaper
15 ```
17 Several Zend Framework components provide integrations for consuming
18 zend-escaper, including [zend-view](https://github.com/zendframework/zend-view),
19 which provides a set of helpers that consume it.
21 > ### Security
23 > zend-escaper is a security related component. As such, if you believe you have
24 > found an issue, we ask that you follow our [Security  Policy](http://framework.zend.com/security/)
25 > and report security issues accordingly. The Zend Framework team and the
26 > contributors thank you in advance.
28 ## Overview
30 zend-escaper provides one class, `Zend\Escaper\Escaper`, which in turn provides
31 five methods for escaping output. Which method to use  depends on the context in
32 which the output is used. It is up to the developer to use the right methods in
33 the right context.
35 `Zend\Escaper\Escaper` has the following escaping methods available for each context:
37 - `escapeHtml`: escape a string for an HTML body context.
38 - `escapeHtmlAttr`: escape a string for an HTML attribute context.
39 - `escapeJs`: escape a string for a Javascript context.
40 - `escapeCss`: escape a string for a CSS context.
41 - `escapeUrl`: escape a string for a URI or URI parameter context.
43 Usage of each method will be discussed in detail in later chapters.
45 ## What zend-Escaper is not
47 zend-escaper is meant to be used only for *escaping data for output*, and as
48 such should not be misused for *filtering input data*. For such tasks, use
49 [zend-filter](https://zendframework.github.io/zend-filter/),
50 [HTMLPurifier](http://htmlpurifier.org/) or PHP's
51 [Filter](http://php.net/filter) functionality should be used.