Strtolower() error panel blueprint.php

I have this error shown in the panel on one of my templates. It doesn’t occur on my development server (MAMP with php 7.0.8) but it does occur on the production server (mediatemple.com with php 7.0.6). Interestingly, the error doesn’t occur in all places where I use the template, but only in some sections of my site.

Any ideas?

Warning: strtolower() expects parameter 1 to be string, array given in {server}/html/panel/app/src/panel/models/page/blueprint.php on line 55

Warning: Illegal offset type in {server}/html/panel/app/src/panel/models/page/blueprint/pages.php on line 56

Have you checked your blueprint indentation?

I did double check the indentation (saw that recommendation in other threads). This is my blueprint:

title: Cell Image
pages: false
files: true
	sortable: true
fields:
	title:
		label: Title
		type:  text
	headline:
		label: Headline
		type: textarea
	subTitle:
		label: Sub-Title
		type: text
	link:
		label: Link
		type: select
		options: query
		query:
			fetch: pages
			value: '{{parent}}/{{uid}}'
			text: '{{title}} [{{parent}}/{{uid}}]'
		help: When you click on this cell, it will direct the user to this part of the site. To do nothing when clicked, leave it blank.
	info_upload:
		label: 
		type: info
		text: The first image in the files collection will be shown.
	line:
		type: line
	info:
		label: Styling Options
		type: info
		text: These options define how a cell will appear on the page
	cellWidth:
		label: Cell Width
		type: select
		default: cell-width100
		options:
			cell-width100: Full Width
			cell-width50: Half Width
			cell-width33: Third Width
		help: How much horizontal space this cell occupies. If "half" or "third" width, add enough same width cells to fill a full row.
	cellPosition:
		label: Cell Text Position
		type: select
		default: cell-style-left-center
		options:
			cell-style-left-top: Left Top
			cell-style-left-center: Left Center
			cell-style-middle: Middle
	cellFontSize:
		label: Cell Font Size
		type: select
		default: cell-font-size-normal
		options:
			cell-font-size-small: Small
			cell-font-size-normal: Normal
	cellFontColor:
		label: Cell Font Color
		type: select
		default: cell-font-color-white
		options:
			cell-font-color-white: White
			cell-font-color-black: Black

You seem to be using tabs instead of whitespace. Yaml indentation uses whitespace. Although when I test your blueprint, I don’t get any errors.

For me this looks suspicious:

files: true
    sortable: true

Shouldn’t it just be:

files:
    sortable: true

Also info_upload: is missing its label: value.

@texnixe @distantnative Thanks for this advice, I made your suggested changes, but the error is still occurring.

  • converted indentation to 2 spaces instead of tabs
  • fixed files: true and missing label:

Current blueprint is:

title: Cell Image
pages: false
files:
  sortable: true
fields:
  title:
    label: Title
    type:  text
  headline:
    label: Headline
    type: textarea
  subTitle:
    label: Sub-Title
    type: text
  link:
    label: Link
    type: select
    options: query
    query:
      fetch: pages
      value: '{{parent}}/{{uid}}'
      text: '{{title}} [{{parent}}/{{uid}}]'
    help: When you click on this cell, it will direct the user to this part of the site. To do nothing when clicked, leave it blank.
  info_upload:
    label: Image Selection
    type: info
    text: The first image in the files collection will be shown.
  line:
    type: line
  info:
    label: Styling Options
    type: info
    text: These options define how a cell will appear on the page
  cellWidth:
    label: Cell Width
    type: select
    default: cell-width100
    options:
      cell-width100: Full Width
      cell-width50: Half Width
      cell-width33: Third Width
    help: How much horizontal space this cell occupies. If "half" or "third" width, add enough same width cells to fill a full row.
  cellPosition:
    label: Cell Text Position
    type: select
    default: cell-style-left-center
    options:
      cell-style-left-top: Left Top
      cell-style-left-center: Left Center
      cell-style-middle: Middle
  cellFontSize:
    label: Cell Font Size
    type: select
    default: cell-font-size-normal
    options:
      cell-font-size-small: Small
      cell-font-size-normal: Normal
  cellFontColor:
    label: Cell Font Color
    type: select
    default: cell-font-color-white
    options:
      cell-font-color-white: White
      cell-font-color-black: Black

Could it be that option keys can’t include -? Or maybe would have to be wrapped by "? Wild guesses, though.

Thanks for the idea @distantnative
I removed all the - chars and the problem is still there :frowning:

I can’t test it myself as I’m on the road, but I would suggest that you try to remove all fields except title and see if the error is still there. If it’s gone, start adding field by field and check when the error re-appears. This way we could narrow down what part of the blueprint causes the error.

It’s not my fault! :slight_smile: The error occurs even if I strip the blueprint down to title: Cell Image alone!

I’m not sure how to get to the bottom of this. It only happens on my production server, and it only occurs if the item is nested like Section > Section > Cell-Image – it doesn’t occur if it’s only one level deep Section > Cell-Image

Weird

Ok, I just had a look at the code lines that throw the error. They deal with the file name of blueprints – it could be the file name of this blueprint but maybe even of another one. Could you just post a list/screenshot of the files in site/blueprints? Maybe that helps us to find the error – we already know a few things that can’t be related :wink:

I see, here are my blueprints:

I don’t think dots are allowed. Try to change top.maison.yml to top-maison.yml.

I have never had problems with dots in blueprint filenames. But it is certainly worth a test.

At https://github.com/getkirby/getkirby.com/tree/master/site/blueprints there are several blueprints with dots in it, so it is possible I think.

You said the issue only occurs when the page is nested, is there anything these parent pages have in common, for example, are the parents using the same blueprint?

@jenstornell It was the dots!

I replaced all . with - in blueprint names, and the error went away. I am surprised this is the case, I’ve never run into problems with using dots in blueprint names before, and indeed I think I was inspired to do so by noticing that naming technique used by kirby as @anon77445132 pointed out.

Well, my immediate problem is solved, though now I have to go back and carefully refactor everything in my site to conform to the new naming strategy.

@texnixe should this be elevated to a bug report?

1 Like

Interesting, because as you said, you do not experience it on localhost nor have you experienced it before. Nor have I either on localhost nor on a production server, and the getkirby site uses dots without problems as well. I haven’t seen this error reported before, either. So I wonder what might be causing this.

But do create an issue on GitHub, it makes sense to further look into this.