Skip to content

Commit 5ab3321

Browse files
committed
Merge pull request #94 from mjrider/for-upstream
improvements for esiFetch and ar/connect/soap
2 parents 9a616d2 + 2c8c7d3 commit 5ab3321

File tree

7 files changed

+22
-11
lines changed

7 files changed

+22
-11
lines changed

docs/CHANGES

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Changes Ariadne 9.4
33
========================
44

5+
Minimum PHP version raised to 5.4.7
6+
57
Changes:
68
- updated composer libraries
79
- php7 support, it passes the unit tests, and is installable. We aren't running
@@ -21,10 +23,13 @@ Bug fixes:
2123
fatal errors when saving templates.
2224
- Fixed an escaping bug in htmlcleaner for attributes
2325
- Fixed mod_tar in pear mode, windows installs should now work again.
24-
- Performance improvements:
26+
- Fixed installer for the usecase where the www dir is copied instead of symlinked
27+
- Fixed esi including schemeless uri's
2528

29+
- Performance improvements:
2630
+- 10% performce gain by improving performance of performance heavy functions
2731

32+
2833
========================
2934
Changes Ariadne 9.3
3035
========================

lib/modules/mod_esi.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ function esiFetch($url) {
107107
} else {
108108
// FIXME: Is it a good idea to do http requests from the server this way?
109109
$client = ar('http')->client();
110+
$scheme = parse_url($url, PHP_URL_SCHEME);
111+
if (!$scheme) {
112+
$url = 'http:'.$url;
113+
}
110114
$replacement = $client->get($url);
111115

112116
if ($client->statusCode != "200") {
@@ -167,7 +171,7 @@ function esiEvaluate($test) {
167171

168172
$compiled=$pinp->compile("<pinp>" . $test . "</pinp>");
169173

170-
$compiled = preg_replace("/^<\?php(.*)\?>$/s", '$1', $compiled);
174+
$compiled = preg_replace("/^<\?php(.*)\?".">$/s", '$1', $compiled);
171175

172176
// FIXME: Is eval after the pinp compiler save enough to run?
173177
$result = eval("return (" . $compiled . ");");
@@ -183,7 +187,7 @@ function esiInclude($page) {
183187
global $ARCurrent, $AR;
184188

185189
// parse <esi:include src="view.html">
186-
$regExp = '|<esi:include.*?>|i';
190+
$regExp = '|<esi:include.*?'.'>|i';
187191

188192

189193
preg_match_all($regExp, $page, $matches);

lib/modules/mod_pinp.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ class pinp {
758758
"dns_get_mx|dns_get_record|getservbyport|getservbyname|ip2long|long2ip|get_headers|http_build_query";
759759
$regex_funcs="ereg|ereg_replace|eregi|eregi_replace|split|spliti|preg_match|".
760760
"preg_match_all|preg_split|preg_quote|preg_grep|preg_filter|preg_last_error";
761+
$stream_functs="stream_context_create|stream_context_get_options|stream_context_get_params|stream_context_set_option|stream_context_set_params";
761762
$string_funcs="addslashes|addcslashes|bin2hex|chop|chr|chunk_split|".
762763
"convert_cyr_string|convert_uudecode|convert_uuencode|count_chars|crc32|crypt|echo|explode|flush|".
763764
"get_html_translation_table|htmlentities|htmlspecialchars|htmlspecialchars_decode|hex2bin|implode|join|".
@@ -808,7 +809,7 @@ class pinp {
808809
"imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8";
809810
$this->allowed_functions=array_flip(explode("|", strtolower("$array_funcs|$object_funcs|$ctype_funcs|$filter_funcs|".
810811
"$control_funcs|$datetime_funcs|$math_funcs|".
811-
"$misc_funcs|$net_funcs|$regex_funcs|$string_funcs|$var_funcs|$xml_funcs|".
812+
"$misc_funcs|$net_funcs|$regex_funcs|$string_funcs|$stream_funcs|$var_funcs|$xml_funcs|".
812813
"$allowed_functions|$debug_funcs|$loader_funcs|$ob_funcs|$iconv_funcs|$mb_funcs|$pspell_funcs|$imap_funcs|$zlib_funcs")));
813814

814815
/*

lib/stores/store.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,15 @@ protected function serialize($value, $path) {
439439
}
440440

441441
protected function unserialize($value, $path) {
442-
if (substr($value, 0, 2) == "O:") {
442+
if ($value[0] === "O" && $value[1] === ":") {
443443
return unserialize($value);
444444
} else if ($this->config['crypto'] instanceof \Closure) {
445445
$crypto = $this->config['crypto']();
446+
list($token,$datavalue) = explode(':', $value, 2);
446447
foreach ($crypto as $cryptoConfig) {
447448
$cryptoToken = $cryptoConfig['token'];
448-
if (substr($value, 0, strlen($cryptoToken)+1) == ($cryptoToken . ":")) {
449-
$value = substr($value, strlen($cryptoToken)+1);
449+
if ($token === $cryptoToken ) {
450+
$value = $datavalue;
450451
switch ($cryptoConfig['method']) {
451452
case 'ar_crypt':
452453
$key = base64_decode($cryptoConfig['key']);
@@ -459,7 +460,7 @@ protected function unserialize($value, $path) {
459460
}
460461
}
461462

462-
if (substr($decryptedValue, 0, 2) == "O:") {
463+
if ($decryptedValue[0] === "O" && $decryptedValue[1] === ":") {
463464
return unserialize($decryptedValue);
464465
} else {
465466
$dummy = unserialize('O:6:"object":7:{s:5:"value";s:0:"";s:3:"nls";O:6:"object":2:{s:7:"default";s:2:"nl";s:4:"list";a:1:{s:2:"nl";s:10:"Nederlands";}}s:2:"nl";O:6:"object":1:{s:4:"name";s:14:"Crypted object";}s:6:"config";O:6:"object":2:{s:10:"owner_name";s:6:"Nobody";s:5:"owner";s:6:"nobody";}s:5:"mtime";i:0;s:5:"ctime";i:0;s:5:"muser";s:6:"nobody";}');

www/install/nls.en.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$ARnls['install:recheck'] = 'Re-run checks';
2424
$ARnls['install:check_ok'] = 'Passed';
2525
$ARnls['install:check_failed'] = 'Failed';
26-
$ARnls['install:check_php_version'] = 'PHP &gt;= 5.4';
26+
$ARnls['install:check_php_version'] = 'PHP &gt;= 5.4.7';
2727
$ARnls['install:check_database_support']= 'Supported database';
2828
$ARnls['install:check_webserver'] = 'Supported webserver';
2929
$ARnls['install:check_accept_path_info']= 'AcceptPathInfo directive in httpd.conf';

www/install/nls.nl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
$ARnls['install:recheck'] = 'Opnieuw controleren';
2626
$ARnls['install:check_ok'] = 'Geslaagd';
2727
$ARnls['install:check_failed'] = 'Mislukt';
28-
$ARnls['install:check_php_version'] = 'PHP &gt;= 5.4';
28+
$ARnls['install:check_php_version'] = 'PHP &gt;= 5.4.7';
2929
$ARnls['install:check_database_support']= 'Ondersteunde database';
3030
$ARnls['install:check_webserver'] = 'Ondersteunde webserver';
3131
$ARnls['install:check_accept_path_info']= 'AcceptPathInfo regel in httpd.conf';

www/install/system_checks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$ariadne = '';
33

44
function check_php_version() {
5-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
5+
if (version_compare(PHP_VERSION, '5.4.7', '>=')) {
66
return true;
77
}
88
return false;

0 commit comments

Comments
 (0)