Welcome Guest, Not a member yet? Register   Sign In
Welcome message out of the box regardless
#1

(This post was last modified: 03-23-2020, 08:15 PM by John_Betong.)

I know this has been discussed before but I do think that being able to immediately display the "Welcome_message" would be beneficial rather than having the unfriendly "Whoops! We seem to have hit a snag message..." appear...

May I propose the following additional JavaScript script which I think is far more informative:

file: system/Cache/Handlers/FileHandler.php
PHP Code:
/**
* Constructor.
*
* @param  type $config
* @throws type
*/
public function __construct($config)
{
$path = ! empty($config->storePath) ? $config->storePath WRITEPATH 'cache';
if (! 
is_really_writable($path))
{

// PROPOSAL START
$aTmp = [
 
'Unable to log Errors and/or warnings'
 
'Please set ../writable folder permissions to 0777',
 
'../writable folder permissions not set to 0777',
 
'Please consult manual regarding ../writable folder',
 
'\t\tWhoops! \n\nWe seem to have hit a snag. \n\n\tPlease try again later...\n\n',
 
'Better suggestions welcome \n\n\t\t :)\n\n',
 
'Shit happens :(',
 ];
$tmp $aTmp[mt_rand(0count($aTmp)-)];

?>
<script>
alert("<?= $tmp ?>");
</script>
<?php
// throw CacheException::forUnableToWrite($path);
// PROPOSAL FINISH

}//endif

$this->prefix $config->prefix ?: '';
$this->path  rtrim($path'/') . '/';
}
//endfunc 

Please note the additional script always shows if and only the writable folder is not writable instead of the following exception:

PHP Code:
  throw CacheException::forUnableToWrite($path); 
Reply
#2

Displaying an error 500 in an alert window with javascript is not a good idea and displaying information about your file system is a security risk.
This message is displayed in production only. In development you should see a lot more information, but in production you don’t want to display too much information when there’s an error. The error details should be written to the log file.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

(This post was last modified: 03-25-2020, 01:36 AM by John_Betong.)

includebeer
Quote:Displaying an error 500 in an alert window with javascript is not a good idea 
When CodeIgniter detects that the writable folder is not writable (0777) a http_request () result of 200 is displayed and not a 500. 


Quote:and displaying information about your file system is a security risk.
There are currently about six error messages which can be displayed and easily changed because the error messages will not suit everybody.


Quote:This message is displayed in production only.
Agreed and it is nor informative to new users who have just downloaded and tried to run the application for the very first time. 


Quote:In development you should see a lot more information, but in production you don’t want to display too much information when there’s an error. 
There is a lot of documentation to and I believe it is not easy to change the default from "production". Displaying a suitable JavaScript messages could make it easier for new users to search for the relevant documentation. 


Quote:The error details should be written to the log file.
If the writable folder is not writable then no error details can be written to the log file.


I have set the online directory permissions to be read only and the results can be found here:

https://ci4-strict.tk
Reply
#4

The installation instructions are clear about the writable folder and the initial setup in general. The first step is to change the ENVIRONNEMENT variable and the permissions of the writable folder : https://codeigniter4.github.io/userguide...ion-set-up

If somebody know nothing about CodeIgniter and install it in production for the first time, then what can we do? It is just stupid. It’s not hard to test on a local server.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB