Closed Ventricule closed 8 years ago
It is save to call session_start
twice, from the PHP docs:
session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
So the message you are getting is just a notice and not an error.
Does the bug only occur, while you are using the if (!isset($_SESSION)) { }
statement?
Hey, you was so fast to reply, super !
Yep, the bug also occur without statement.
I have a kirby 2.3 installation, and it happen locally and on the server.
No problems on starterkit fresh install (even no session warning)...
Will try to add plugins one by one
Hm, this is strange, indeed. Have you tried removing the if
statement and restarting your webbrowser?
No problem with other plugins,
and I tried in multiple browsers,
but c::set('date.handler', 'strftime');
seems to be the origin of the problem !
Why do you think that c::set('date.handler', …)
is responsible for the problem? Could you please paste the PHP messages you are getting.
When I set date.handler
to strftime
comments are no more listed, but I don't have any messages.
The KirbyComments plugin does use Kirby’s default date
function in comments/comments.php on line 95. Currently I am not sure how date.handler
works and if there are any correlations between this option and #2. I am going to have a look at this.
Hey,
I find a solution with your help,
replacing line 95 by $comment_page->date('%F %T')
do the job.
Well, '%F %T'
does the job, if the date handler is set to strftime
, because strftime
escapes the time-string differently. To create a universal solution, I will have to work with the timestamp directly (see working with the timestamp in the Kirby docs). Expect a new release of this plugin in the following days.
Yes, sure, you will find a better solution. Thank you for your help !
Changing line 95 to …
new DateTime(date('c', $comment_page->date()))
… should do the trick. I am going to test this and release it in the following days.
Hello,
I get a session_start error :
Notice: A session had already been started - ignoring session_start() in [...] comments.php on line 103
I placed
if (!isset($_SESSION)) { }
aroundsession_start()
I have no more error message.But, thats still not working :
I can send a first comment, the file is created, I can see it in the panel. But when I reload the page, the list is empty and $comments->isEmpty() throw 1... All params are at default value. And after the first comment, when I want to preview, the page is only reloaded, without any change or error code.
I don't know where to begin my investigation...