Skip to content

Commit

Permalink
Merge pull request #1020 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests:

#9140
#9204
#9133
#6778
#7556
#8903
  • Loading branch information
Oleksii Korshenko authored Apr 12, 2017
2 parents a9bd85b + 6e87013 commit e9d894f
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ atlassian*
!/pub/media/customer/.htaccess
/pub/media/downloadable/*
!/pub/media/downloadable/.htaccess
/pub/media/favicon/*
/pub/media/import/*
!/pub/media/import/.htaccess
/pub/media/theme/*
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Contact/Model/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function __construct(
*/
public function send($replyTo, array $variables)
{
/** @see \Magento\Contact\Controller\Index\Post::validatedParams() */
$replyToName = !empty($variables['data']['name']) ? $variables['data']['name'] : null;

$this->inlineTranslation->suspend();
try {
$transport = $this->transportBuilder
Expand All @@ -62,7 +65,7 @@ public function send($replyTo, array $variables)
->setTemplateVars($variables)
->setFrom($this->contactsConfig->emailSender())
->addTo($this->contactsConfig->emailRecipient())
->setReplyTo($replyTo)
->setReplyTo($replyTo, $replyToName)
->getTransport();

$transport->sendMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<item name="weee" xsi:type="array">
<item name="component" xsi:type="string">Magento_Weee/js/view/cart/totals/weee</item>
<item name="config" xsi:type="array">
<item name="title" xsi:type="string">FPT</item>
<item name="title" xsi:type="string" translate="true">FPT</item>
</item>
</item>
</item>
Expand Down
22 changes: 2 additions & 20 deletions lib/internal/Magento/Framework/App/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public function __construct(ObjectManagerFactory $factory, $rootDir, array $init
$this->factory = $factory;
$this->rootDir = $rootDir;
$this->server = $initParams;
$this->objectManager = $this->factory->create($this->server);
}

/**
Expand All @@ -227,7 +228,6 @@ public function getParams()
public function createApplication($type, $arguments = [])
{
try {
$this->initObjectManager();
$application = $this->objectManager->create($type, $arguments);
if (!($application instanceof AppInterface)) {
throw new \InvalidArgumentException("The provided class doesn't implement AppInterface: {$type}");
Expand All @@ -250,7 +250,6 @@ public function run(AppInterface $application)
try {
\Magento\Framework\Profiler::start('magento');
$this->initErrorHandler();
$this->initObjectManager();
$this->assertMaintenance();
$this->assertInstalled();
$response = $application->launch();
Expand Down Expand Up @@ -279,7 +278,6 @@ protected function assertMaintenance()
if (null === $isExpected) {
return;
}
$this->initObjectManager();
/** @var \Magento\Framework\App\MaintenanceMode $maintenance */
$this->maintenance = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);

Expand Down Expand Up @@ -312,7 +310,6 @@ protected function assertInstalled()
if (null === $isExpected) {
return;
}
$this->initObjectManager();
$isInstalled = $this->isInstalled();
if (!$isInstalled && $isExpected) {
$this->errorCode = self::ERR_IS_INSTALLED;
Expand Down Expand Up @@ -351,7 +348,6 @@ private function getIsExpected($key, $default)
*/
private function isInstalled()
{
$this->initObjectManager();
/** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
$deploymentConfig = $this->objectManager->get(\Magento\Framework\App\DeploymentConfig::class);
return $deploymentConfig->isAvailable();
Expand All @@ -364,7 +360,6 @@ private function isInstalled()
*/
public function getObjectManager()
{
$this->initObjectManager();
return $this->objectManager;
}

Expand All @@ -378,20 +373,7 @@ private function initErrorHandler()
$handler = new ErrorHandler();
set_error_handler([$handler, 'handler']);
}

/**
* Initializes object manager
*
* @return void
*/
private function initObjectManager()
{
if (!$this->objectManager) {
$this->objectManager = $this->factory->create($this->server);
$this->maintenance = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);
}
}


/**
* Getter for error code
*
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/Magento/Framework/App/ObjectManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ObjectManagerFactory
*
* @var string
*/
protected $_locatorClassName = \Magento\Framework\ObjectManager\ObjectManager::class;
protected $_locatorClassName = \Magento\Framework\App\ObjectManager::class;

/**
* Config class name
Expand Down Expand Up @@ -169,7 +169,6 @@ public function create(array $arguments)
$objectManager = new $this->_locatorClassName($this->factory, $diConfig, $sharedInstances);

$this->factory->setObjectManager($objectManager);
ObjectManager::setInstance($objectManager);

$generatorParams = $diConfig->getArguments(\Magento\Framework\Code\Generator::class);
/** Arguments are stored in different format when DI config is compiled, thus require custom processing */
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Config/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function getIdAttributes()
{
$idAttributes = [
'/view/vars' => 'module',
'/view/vars/var' => 'name',
'/view/vars/(var/)*var' => 'name',
'/view/exclude/item' => ['type', 'item'],
];
foreach ($this->xpath as $attribute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '' is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '' is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
Expand All @@ -188,32 +188,14 @@
"\nLine: 2\n",
],
],
'virtualtype with invalid_name' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="\\BackslashPrefix\\IsNotAllowed" type="TypeName" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\BackslashPrefix\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '\\BackslashPrefix\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
"invalid or something strange happend." .
"\nLine: 2\n",
],
],
'virtualtype with empty_type' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="Name" type="" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'type': [facet 'pattern'] The value '' is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'type': '' is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
Expand All @@ -226,8 +208,8 @@
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '777Digits\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '777Digits\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
Expand All @@ -237,4 +219,22 @@
"\nLine: 2\n",
],
],
'virtualtype with digits_and_prefix_slash' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="\\777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\777Digits\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '\\777Digits\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
"invalid or something strange happend." .
"\nLine: 2\n",
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@
</argument>
</arguments>
</type>
<virtualType name="\BackslashPrefix\IsAllowed" type="TypeName" shared="true"/>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="([a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
<xs:pattern value="(\\?[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
</xs:restriction>
</xs:simpleType>

Expand Down

0 comments on commit e9d894f

Please sign in to comment.