[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[H-source-users] [PATCH] minor changes to dispel php notices
From: |
Yuchen Pei |
Subject: |
[H-source-users] [PATCH] minor changes to dispel php notices |
Date: |
Thu, 09 Sep 2021 17:57:47 +1000 |
User-agent: |
mu4e 1.4.13; emacs 27.2 |
The app is running on staging server without docker now. This
patch fixes php notices that would pop up when display_errors is
On and error_reporting is E_ALL. I have already pushed it to the
staging server, and will push to development branch if no
opposition.
Next will be bringing the prod server up to php7. I assume some
tests are needed in the staging instance before that, but I'm not
sure which tests. Any ideas?
From ad2cfad59b62b1b188d76d83ebf89b3dc69787f3 Mon Sep 17 00:00:00 2001
From: Yuchen Pei <hi@ypei.me>
Date: Thu, 9 Sep 2021 17:33:45 +1000
Subject: [PATCH] minor changes to dispel php notices
- end():
https://stackoverflow.com/questions/4636166/only-variables-should-be-passed-by-reference
- get_magic_quotes_gpc() always returns false:
https://www.php.net/manual/en/function.get-magic-quotes-gpc.php
- __autoload():
https://stackoverflow.com/questions/50780678/deprecated-autoload-is-deprecated-use-spl-autoload-register
---
h-source/Library/Call.php | 8 +++++---
h-source/Library/Functions.php | 5 +----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/h-source/Library/Call.php b/h-source/Library/Call.php
index c75508b..a9145c2 100755
--- a/h-source/Library/Call.php
+++ b/h-source/Library/Call.php
@@ -257,7 +257,7 @@ function getQueryString()
return '';
}
-function __autoload($className)
+function autoloader($className)
{
$backupName = $className;
@@ -290,6 +290,7 @@ function __autoload($className)
}
}
+spl_autoload_register('autoloader');
try {
@@ -324,7 +325,8 @@ try {
//load the files defined inside Config/Autoload.php
foreach (Autoload::$files as $file)
{
- $ext = strtolower(end(explode('.', $file)));
+ $parts = explode('.', $file);
+ $ext = strtolower(end($parts));
$path = ROOT . DS . APPLICATION_PATH . DS . 'Include' . DS .
$file;
if (file_exists($path) and $ext === 'php')
{
@@ -354,4 +356,4 @@ try {
echo '<div class="alert">Message: '.$e->getMessage().'</div>';
-}
\ No newline at end of file
+}
diff --git a/h-source/Library/Functions.php b/h-source/Library/Functions.php
index 1477680..e0e77bf 100755
--- a/h-source/Library/Functions.php
+++ b/h-source/Library/Functions.php
@@ -107,9 +107,6 @@ SANITIZE DEEP
*/
function stripslashesDeep($value) {
- if(get_magic_quotes_gpc()) {#if stripslashes
- return array_map('stripslashes', $value);
- }
return $value;
}
@@ -304,4 +301,4 @@ function xml_encode($string)
}
return strtr($string, $trans);
-}
\ No newline at end of file
+}
--
2.33.0
--
Best,
Yuchen
PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0
<https://ypei.me/assets/ypei-pubkey.txt>
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [H-source-users] [PATCH] minor changes to dispel php notices,
Yuchen Pei <=