Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.vagrant
tests/Zend/Db/Table/_files/cachefiles/*
tests/Zend/Auth/Adapter/OpenId/_files/*
Expand Down
8 changes: 4 additions & 4 deletions library/Zend/Barcode/Object/Upce.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ protected function _getDefaultOptions()
public function getText()
{
$text = parent::getText();
if ($text{0} != 1) {
$text{0} = 0;
if ($text[0] != 1) {
$text[0] = 0;
}
return $text;
}
Expand Down Expand Up @@ -222,8 +222,8 @@ protected function _validateText($value, $options = array())
public function getChecksum($text)
{
$text = $this->_addLeadingZeros($text, true);
if ($text{0} != 1) {
$text{0} = 0;
if ($text[0] != 1) {
$text[0] = 0;
}
return parent::getChecksum($text);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct(array $options = array())
public function setDirectives($directives)
{
if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array');
while (list($name, $value) = each($directives)) {
foreach ($directives as $name => $value) {
if (!is_string($name)) {
Zend_Cache::throwException("Incorrect option name : $name");
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ protected function _redirect($url, array $options = array())
/**
* Redirect to another URL
*
* Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}.
* Proxies to @see Zend_Controller_Action_Helper_Redirector::gotoUrl()
*
* @param string $url
* @param array $options Options to be used when redirecting
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Db/Adapter/Pdo/Pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function describeTable($tableName, $schemaName = null)
t.typname AS type,
a.atttypmod,
FORMAT_TYPE(a.atttypid, a.atttypmod) AS complete_type,
d.adsrc AS default_value,
pg_get_expr(d.adbin, d.adrelid) AS default_value,
a.attnotnull AS notnull,
a.attlen AS length,
co.contype,
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Feed/Atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected function _mapFeedHeaders($array)
* The following nodes are constructed for each feed entry
* <entry>
* <id>url to feed entry</id>
* <title>entry title</title>
* <title data-heap-redact-text="true">entry title</title>
* <updated>last update</updated>
* <link rel="alternate" href="url to feed entry" />
* <summary>short text</summary>
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Feed/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ private function _buildiTunes(DOMElement $root, $array)
*
* The following nodes are constructed for each feed entry
* <item>
* <title>entry title</title>
* <title data-heap-redact-text="true">entry title</title>
* <link>url to feed entry</link>
* <guid>url to feed entry</guid>
* <description>short text</description>
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Filter/Compress/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function decompress($content)
for ($i = 0; $i < $zip->numFiles; $i++) {
$statIndex = $zip->statIndex($i);
$currName = $statIndex['name'];
if (($currName{0} == '/') ||
if (($currName[0] == '/') ||
(substr($currName, 0, 2) == '..') ||
(substr($currName, 0, 4) == './..')
)
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ public function clearDisplayGroups()
* @param array $values
* @return Zend_Form
*/
public function populate(array $values)
public function populate(array $values=[])
{
return $this->setDefaults($values);
}
Expand Down Expand Up @@ -2981,7 +2981,7 @@ public function setSubFormDecorators(array $decorators)
* @param Zend_View_Interface $view
* @return string
*/
public function render(Zend_View_Interface $view = null)
public function render($view = null)
{
if (null !== $view) {
$this->setView($view);
Expand Down
2 changes: 2 additions & 0 deletions library/Zend/Form/Decorator/FormErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $vie
}
}

$label = strip_tags($label);

if ($this->getEscape()) {
$label = $view->escape($label);
}
Expand Down
24 changes: 24 additions & 0 deletions library/Zend/Form/DisplayGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1179,4 +1179,28 @@ protected function _loadDecorator(array $decorator, $name)

return $instance;
}

/**
* Custom Actionstep Hack
* @return $this
*/
public function setLayoutOutline() {
$class = $this->getDecorator('Fieldset')->getOption('class');
$class .= ' as-form-group--outlined';
$this->getDecorator('Fieldset')->setOption('class', $class);
return $this;
}


/**
* Custom Actionstep Hack
* @return $this
*/
public function setLayoutIndented() {
$class = $this->getDecorator('Fieldset')->getOption('class');
$class .= ' as-form-group--indented';
$this->getDecorator('Fieldset')->setOption('class', $class);
return $this;
}

}
6 changes: 3 additions & 3 deletions library/Zend/Form/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function getId()
* Set element value
*
* @param mixed $value
* @return Zend_Form_Element
* @return $this
*/
public function setValue($value)
{
Expand Down Expand Up @@ -852,10 +852,10 @@ public function getType()
*
* @param string $name
* @param mixed $value
* @return Zend_Form_Element
* @return $this
* @throws Zend_Form_Exception for invalid $name values
*/
public function setAttrib($name, $value)
public function setAttrib($name, $value=null)
{
$name = (string) $name;
if ('_' == $name[0]) {
Expand Down
18 changes: 15 additions & 3 deletions library/Zend/Http/Client/Adapter/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,24 @@ protected function connectHandshake(

// If all is good, switch socket to secure mode. We have to fall back
// through the different modes

/**
* Lance: Update to use TLS 1.2
*/
$modes = array(
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
STREAM_CRYPTO_METHOD_TLS_CLIENT,
STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
STREAM_CRYPTO_METHOD_SSLv2_CLIENT
STREAM_CRYPTO_METHOD_SSLv3_CLIENT
);

/**
* Lance: Set verify peer etc to false, otherwise proxy calls will always fail.
* Was defaulted to false in PHP when this library was created, but since php 5.6 it is enabled by default, so needs hack to fix.
* @see https://stackoverflow.com/questions/33497040/zend-unable-to-connect-to-https-server-through-proxy
*/
stream_context_set_option($this->socket, "ssl", "verify_peer", false);
stream_context_set_option($this->socket, "ssl", "verify_peer_name", false);
stream_context_set_option($this->socket, "ssl", "allow_self_signed", false);

$success = false;
foreach($modes as $mode) {
Expand Down
103 changes: 103 additions & 0 deletions library/Zend/Http/UserAgent/Features/Adapter/WurflApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Http
* @subpackage UserAgent
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

/**
* Zend_Http_UserAgent_Features_Adapter_Interface
*/
require_once 'Zend/Http/UserAgent/Features/Adapter.php';

/**
* Features adapter build with the official WURFL PHP API
* See installation instruction here : http://wurfl.sourceforge.net/nphp/
* Download : http://sourceforge.net/projects/wurfl/files/WURFL PHP/1.1/wurfl-php-1.1.tar.gz/download
*
* @package Zend_Http
* @subpackage UserAgent
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Http_UserAgent_Features_Adapter_WurflApi
implements Zend_Http_UserAgent_Features_Adapter
{
const DEFAULT_API_VERSION = '1.1';

/**
* Get features from request
*
* @param array $request $_SERVER variable
* @return array
*/
public static function getFromRequest($request, array $config)
{
if (!isset($config['wurflapi'])) {
require_once 'Zend/Http/UserAgent/Features/Exception.php';
throw new Zend_Http_UserAgent_Features_Exception('"wurflapi" configuration is not defined');
}

$config = $config['wurflapi'];

if (empty($config['wurfl_lib_dir'])) {
require_once 'Zend/Http/UserAgent/Features/Exception.php';
throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_lib_dir" parameter is not defined');
}
if (empty($config['wurfl_config_file']) && empty($config['wurfl_config_array'])) {
require_once 'Zend/Http/UserAgent/Features/Exception.php';
throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_config_file" parameter is not defined');
}

if (empty($config['wurfl_api_version'])) {
$config['wurfl_api_version'] = self::DEFAULT_API_VERSION;
}

switch ($config['wurfl_api_version']) {
case '1.0':
// Zend_Http_UserAgent::$config['wurfl_config_file'] must be an XML file
require_once ($config['wurfl_lib_dir'] . 'WURFLManagerProvider.php');
$wurflManager = WURFL_WURFLManagerProvider::getWURFLManager(Zend_Http_UserAgent::$config['wurfl_config_file']);
break;
case '1.1':
require_once ($config['wurfl_lib_dir'] . 'Application.php');
if (!empty($config['wurfl_config_file'])) {
$wurflConfig = WURFL_Configuration_ConfigFactory::create($config['wurfl_config_file']);
} elseif (!empty($config['wurfl_config_array'])) {
$c = $config['wurfl_config_array'];
$wurflConfig = new WURFL_Configuration_InMemoryConfig();
$wurflConfig->wurflFile($c['wurfl']['main-file'])
->wurflPatch($c['wurfl']['patches'])
->persistence($c['persistence']['provider'], $c['persistence']['dir']);
}

$wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
$wurflManager = $wurflManagerFactory->create();
break;
default:
require_once 'Zend/Http/UserAgent/Features/Exception.php';
throw new Zend_Http_UserAgent_Features_Exception(sprintf(
'Unknown API version "%s"',
$config['wurfl_api_version']
));
}

$device = $wurflManager->getDeviceForHttpRequest(array_change_key_case($request, CASE_UPPER));
$features = $device->getAllCapabilities();
return $features;
}
}
2 changes: 1 addition & 1 deletion library/Zend/Json/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ protected static function _utf162utf8($utf16)
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}

$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);

switch (true) {
case ((0x7F & $bytes) == $bytes):
Expand Down
14 changes: 7 additions & 7 deletions library/Zend/Json/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,17 +558,17 @@ protected static function _utf82utf16($utf8)
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8[1])));

case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8[2])));
}

// ignoring UTF-32 for now, sorry
Expand Down
4 changes: 4 additions & 0 deletions library/Zend/Loader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public static function autoload($class)
{
$self = self::getInstance();

if (strpos($class, "Google") !== false && defined('USE_MONO_GOOGLE') && USE_MONO_GOOGLE === 1) {
return false;
}

foreach ($self->getClassAutoloaders($class) as $autoloader) {
if ($autoloader instanceof Zend_Loader_Autoloader_Interface) {
if ($autoloader->autoload($class)) {
Expand Down
8 changes: 6 additions & 2 deletions library/Zend/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,12 @@ public function addTo($email, $name='')
}

foreach ($email as $n => $recipient) {
$this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
$this->_to[] = $recipient;
// Custom hack - trim recipient and check for empty
$recipient = trim($recipient);
if (!empty($recipient)) {
$this->_addRecipientAndHeader('To', $recipient, is_int($n) ? '' : $n);
$this->_to[] = $recipient;
}
}

return $this;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Mail/Header/HeaderValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static function assertValid($value)
{
if (! self::isValid($value)) {
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Invalid header value detected');
throw new Zend_Mail_Exception('Invalid header value detected: ' . $value);
}
}
}
3 changes: 2 additions & 1 deletion library/Zend/Mail/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function __construct(array $params)
} else if (isset($params['headers'])) {
if (is_array($params['headers'])) {
$this->_headers = $params['headers'];
$this->_validateHeaders($this->_headers);
//$this->_validateHeaders($this->_headers);
} else {
if (!empty($params['noToplines'])) {
Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $null, "\r\n");
Expand Down Expand Up @@ -597,6 +597,7 @@ protected function _validateHeaders(array $headers, $assertNames = true)
continue;
}

$value = str_replace("\r\n", "\r", $value);
Zend_Mail_Header_HeaderValue::assertValid($value);
}
}
Expand Down
Loading