Pico: Pico 2.1.4 problem with Pico.php / strftime

Hello!!

Sorry for bothering, I wouldn’t if I could find a solution by my own.

I am trying to install the new Pico 2.1.4 on Apache2 in Ubuntu 20.04. Everything is ok until I upload the index.md file. Then I get a white screen.

The Apache error logs points to Pico.php

[Mon Sep 05 22:00:52.876940 2022] [php:error] [pid 79888] [client XXXX.XXXX.XXXX.XXXX:XXXXX] 
PHP Fatal error:  Uncaught TypeError: strftime(): 
Argument #2 ($timestamp) must be of type ?int, string given in /..../pico/vendor/picocms/pico/lib/Pico.php:1527\n
Stack trace:\n
#0 /.../pico/vendor/picocms/pico/lib/Pico.php(1527): strftime()\n
#1 /.../pico/vendor/picocms/pico/lib/Pico.php(1760): Pico->parseFileMeta()\n
#2 /..../pico/vendor/picocms/pico/lib/Pico.php(493): Pico->readPages()\n
#3 /..../pico/index.php(33): Pico->run()\n#4 {main}\n  
thrown in /.../pico/vendor/picocms/pico/lib/Pico.php on line 1527

The date format I am using is the most common in Spain and Latin America date_format: '%d/%m/%Y'. I had some problems before with Pico page ordering, but I could solve them hacking a little bit the Pagination plugin to accept the data format. But this time it is not solvable with a touch in a plugin, it is a core issue…

Could you help me, please? Thanks a lot in advance!!

PS. If you are asking yourself about how I changed the Pagination plugin (which is independent of the problem now becasue I have not uploaded the pagination plugin and I am using the default theme) it was just a little change:

....
	// if filter_date is true, it filters so only dated items are returned.
		
		
		if ($this->config['filter_date']) {
			$show_pages = array();
			foreach($pages as $key=>$page) {
			
				if ($page['date']) {
				
					
					$page['nuevafecha'] = str_replace("/", ".", $page[date]);
					$page['nuevafecha'] = strtotime($page['nuevafecha']);
					$page['nuevafecha'] = date("Y-m-d", $page['nuevafecha']);
					
					$show_pages[$key] = $page; 
				}
			}
		} else {
			$show_pages = $pages;
		}
		// get total pages before show_pages is sliced
....

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15

Most upvoted comments

@PhrozenByte, I don’t know how in-depth you’ve been able to look at the rewrite, but it has come along quite a bit since it’s early days (eg, since I revived it). Not promising it would free my schedule to work on it right away, but, it would be nice to know if you thought it was roughly heading in the right direction. 👀

Basically anything is better than the current docs, so, yeah, this is an easy answer: Yes 😆

Jokes aside, the idea of splitting things up into more natural “topics” is a good one for sure. The topics should be self-containing and thus rather small. Apart from that I’d rather not get involved too deeply here, simply because I believe that my deeper involvement is one of the major reasons why the current docs aren’t suitable for non-developers. So, I’d like to suggest that non-developers (like you folks 👍) overhaul the docs and I rather just check for misunderstandings in the end. Surely I can - only if desired! - add a few notes about possible additions in the end, but I’d still like to leave things up to you whether these should be included or not, and if yes, where.