Skip to content

Commit 46bcab6

Browse files
Merge pull request #519 from magento-east/pr-2.1
Fixed issues: - MAGETWO-58090: [Magento Cloud] - Intermittent HTTP ERROR 500 during checkout - MAGETWO-59024: [Github] Ship To section on Checkout's Review & Payments step, clears out the Ship To address on page reload - MAGETWO-55447: Portdown MAGETWO-54718 down to M2.1.x branch - MAGETWO-55662: Portdown MAGETWO-51428 down to M2.1.x branch - MAGETWO-59209: [Github] Minicart item count is not updated if switch from https to http #6487 - MAGETWO-56964: [GitHub] Validate attribute values #4881
2 parents 05619f7 + db02994 commit 46bcab6

File tree

22 files changed

+541
-313
lines changed

22 files changed

+541
-313
lines changed

.htaccess

Lines changed: 2 additions & 209 deletions
Original file line numberDiff line numberDiff line change
@@ -1,213 +1,43 @@
1-
############################################
2-
## overrides deployment configuration mode value
3-
## use command bin/magento deploy:mode:set to switch modes
4-
5-
# SetEnv MAGE_MODE developer
6-
7-
############################################
8-
## uncomment these lines for CGI mode
9-
## make sure to specify the correct cgi php binary file name
10-
## it might be /cgi-bin/php-cgi
11-
12-
# Action php5-cgi /cgi-bin/php5-cgi
13-
# AddHandler php5-cgi .php
14-
15-
############################################
16-
## GoDaddy specific options
17-
18-
# Options -MultiViews
19-
20-
## you might also need to add this line to php.ini
21-
## cgi.fix_pathinfo = 1
22-
## if it still doesn't work, rename php.ini to php5.ini
23-
24-
############################################
25-
## this line is specific for 1and1 hosting
26-
27-
#AddType x-mapp-php5 .php
28-
#AddHandler x-mapp-php5 .php
29-
30-
############################################
31-
## default index file
32-
33-
DirectoryIndex index.php
34-
1+
# All explanations you could find in .htaccess.sample file
2+
DirectoryIndex index.php
353
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
404
php_value memory_limit 768M
415
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
476
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
577
php_flag suhosin.session.cryptua off
58-
598
</IfModule>
60-
619
<IfModule mod_php7.c>
62-
63-
############################################
64-
## adjust memory limit
65-
6610
php_value memory_limit 768M
6711
php_value max_execution_time 18000
68-
69-
############################################
70-
## disable automatic session start
71-
## before autoload was initialized
72-
7312
php_flag session.auto_start off
74-
75-
############################################
76-
## enable resulting html compression
77-
78-
#php_flag zlib.output_compression on
79-
80-
###########################################
81-
## disable user agent verification to not break multiple image upload
82-
8313
php_flag suhosin.session.cryptua off
84-
8514
</IfModule>
86-
8715
<IfModule mod_security.c>
88-
###########################################
89-
## disable POST processing to not break multiple image upload
90-
9116
SecFilterEngine Off
9217
SecFilterScanPOST Off
9318
</IfModule>
94-
95-
<IfModule mod_deflate.c>
96-
97-
############################################
98-
## enable apache served files compression
99-
## http://developer.yahoo.com/performance/rules.html#gzip
100-
101-
# Insert filter on all content
102-
###SetOutputFilter DEFLATE
103-
# Insert filter on selected content types only
104-
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json image/svg+xml
105-
106-
# Netscape 4.x has some problems...
107-
#BrowserMatch ^Mozilla/4 gzip-only-text/html
108-
109-
# Netscape 4.06-4.08 have some more problems
110-
#BrowserMatch ^Mozilla/4\.0[678] no-gzip
111-
112-
# MSIE masquerades as Netscape, but it is fine
113-
#BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
114-
115-
# Don't compress images
116-
#SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
117-
118-
# Make sure proxies don't deliver the wrong content
119-
#Header append Vary User-Agent env=!dont-vary
120-
121-
</IfModule>
122-
12319
<IfModule mod_ssl.c>
124-
125-
############################################
126-
## make HTTPS env vars available for CGI mode
127-
12820
SSLOptions StdEnvVars
129-
13021
</IfModule>
131-
132-
############################################
133-
## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
134-
## Please, set it on virtual host configuration level
135-
136-
## SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
137-
############################################
138-
13922
<IfModule mod_rewrite.c>
140-
141-
############################################
142-
## enable rewrites
143-
14423
Options +FollowSymLinks
14524
RewriteEngine on
146-
147-
############################################
148-
## you can put here your magento root folder
149-
## path relative to web root
150-
151-
#RewriteBase /magento/
152-
153-
############################################
154-
## workaround for HTTP authorization
155-
## in CGI environment
156-
15725
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
158-
159-
############################################
160-
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
161-
16226
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
16327
RewriteRule .* - [L,R=405]
164-
165-
############################################
166-
## redirect for mobile user agents
167-
168-
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
169-
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
170-
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
171-
172-
############################################
173-
## never rewrite for existing files, directories and links
174-
17528
RewriteCond %{REQUEST_FILENAME} !-f
17629
RewriteCond %{REQUEST_FILENAME} !-d
17730
RewriteCond %{REQUEST_FILENAME} !-l
178-
179-
############################################
180-
## rewrite everything else to index.php
181-
18231
RewriteRule .* index.php [L]
183-
18432
</IfModule>
185-
186-
187-
############################################
188-
## Prevent character encoding issues from server overrides
189-
## If you still have problems, use the second line instead
190-
19133
AddDefaultCharset Off
192-
#AddDefaultCharset UTF-8
19334
AddType 'text/html; charset=UTF-8' html
194-
19535
<IfModule mod_expires.c>
196-
197-
############################################
198-
## Add default Expires header
199-
## http://developer.yahoo.com/performance/rules.html#expires
200-
20136
ExpiresDefault "access plus 1 year"
20237
ExpiresByType text/html A0
20338
ExpiresByType text/plain A0
204-
20539
</IfModule>
206-
207-
###########################################
208-
## Deny access to root files to hide sensitive application information
20940
RedirectMatch 403 /\.git
210-
21141
<Files composer.json>
21242
order allow,deny
21343
deny from all
@@ -280,48 +110,11 @@
280110
order allow,deny
281111
deny from all
282112
</Files>
283-
284-
# For 404s and 403s that aren't handled by the application, show plain 404 response
285113
ErrorDocument 404 /pub/errors/404.php
286114
ErrorDocument 403 /pub/errors/404.php
287-
288-
################################
289-
## If running in cluster environment, uncomment this
290-
## http://developer.yahoo.com/performance/rules.html#etags
291-
292-
#FileETag none
293-
294-
# ######################################################################
295-
# # INTERNET EXPLORER #
296-
# ######################################################################
297-
298-
# ----------------------------------------------------------------------
299-
# | Document modes |
300-
# ----------------------------------------------------------------------
301-
302-
# Force Internet Explorer 8/9/10 to render pages in the highest mode
303-
# available in the various cases when it may not.
304-
#
305-
# https://hsivonen.fi/doctype/#ie8
306-
#
307-
# (!) Starting with Internet Explorer 11, document modes are deprecated.
308-
# If your business still relies on older web apps and services that were
309-
# designed for older versions of Internet Explorer, you might want to
310-
# consider enabling `Enterprise Mode` throughout your company.
311-
#
312-
# https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode
313-
# http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx
314-
315115
<IfModule mod_headers.c>
316-
317116
Header set X-UA-Compatible "IE=edge"
318-
319-
# `mod_headers` cannot match based on the content-type, however,
320-
# the `X-UA-Compatible` response header should be send only for
321-
# HTML documents and not for the other resources.
322-
323117
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
324118
Header unset X-UA-Compatible
325119
</FilesMatch>
326-
327120
</IfModule>

.htaccess.sample

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030
############################################
3131
## default index file
3232

33-
DirectoryIndex index.php
33+
DirectoryIndex index.php
3434

3535
<IfModule mod_php5.c>
36-
3736
############################################
3837
## adjust memory limit
3938

@@ -55,11 +54,8 @@
5554
## disable user agent verification to not break multiple image upload
5655

5756
php_flag suhosin.session.cryptua off
58-
5957
</IfModule>
60-
6158
<IfModule mod_php7.c>
62-
6359
############################################
6460
## adjust memory limit
6561

@@ -81,9 +77,7 @@
8177
## disable user agent verification to not break multiple image upload
8278

8379
php_flag suhosin.session.cryptua off
84-
8580
</IfModule>
86-
8781
<IfModule mod_security.c>
8882
###########################################
8983
## disable POST processing to not break multiple image upload

.user.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
memory_limit = 768M
2+
max_execution_time = 18000
3+
session.auto_start = off
4+
suhosin.session.cryptua = off

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Backend\Block\Media\Uploader;
1717
use Magento\Framework\View\Element\AbstractBlock;
1818
use Magento\Framework\App\Filesystem\DirectoryList;
19+
use Magento\Framework\Exception\FileSystemException;
1920

2021
class Content extends \Magento\Backend\Block\Widget
2122
{
@@ -34,6 +35,11 @@ class Content extends \Magento\Backend\Block\Widget
3435
*/
3536
protected $_jsonEncoder;
3637

38+
/**
39+
* @var \Magento\Catalog\Helper\Image
40+
*/
41+
private $imageHelper;
42+
3743
/**
3844
* @param \Magento\Backend\Block\Template\Context $context
3945
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
@@ -128,12 +134,18 @@ public function getImagesJson()
128134
is_array($value['images']) &&
129135
count($value['images'])
130136
) {
131-
$directory = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
137+
$mediaDir = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
132138
$images = $this->sortImagesByPosition($value['images']);
133139
foreach ($images as &$image) {
134140
$image['url'] = $this->_mediaConfig->getMediaUrl($image['file']);
135-
$fileHandler = $directory->stat($this->_mediaConfig->getMediaPath($image['file']));
136-
$image['size'] = $fileHandler['size'];
141+
try {
142+
$fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file']));
143+
$image['size'] = $fileHandler['size'];
144+
} catch (FileSystemException $e) {
145+
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image');
146+
$image['size'] = 0;
147+
$this->_logger->warning($e);
148+
}
137149
}
138150
return $this->_jsonEncoder->encode($images);
139151
}
@@ -227,4 +239,17 @@ public function getImageTypesJson()
227239
{
228240
return $this->_jsonEncoder->encode($this->getImageTypes());
229241
}
242+
243+
/**
244+
* @return \Magento\Catalog\Helper\Image
245+
* @deprecated
246+
*/
247+
private function getImageHelper()
248+
{
249+
if ($this->imageHelper === null) {
250+
$this->imageHelper = \Magento\Framework\App\ObjectManager::getInstance()
251+
->get('Magento\Catalog\Helper\Image');
252+
}
253+
return $this->imageHelper;
254+
}
230255
}

0 commit comments

Comments
 (0)