# Notice: Array to string conversion in /var/www/app/web/wp/wp-includes/general-template.php on line 1200

**URL:** https://discourse.roots.io/t/notice-array-to-string-conversion-in-var-www-app-web-wp-wp-includes-general-template-php-on-line-1200/20192
**Category:** sage
**Tags:** sage9
**Created:** 2021-02-24T18:41:44Z
**Posts:** 19

## Post 1 by @markusflint — 2021-02-24T18:41:44Z

Hey all

I have a fresh install of Sage9, on PHP 7.3 and without changing anything yet, I’m getting the above code.

If I comment out `@php wp_head() @endphp` from `partials/head.blade.php` then that error goes away. Has anyone found out the cause of this?

Would appreciate any assistance, thank you.

---

## Post 2 by @MWDelaney — 2021-02-24T22:05:15Z

I kind of wonder if this is a hosting issue. Who is your host for this site?

---

## Post 3 by @markusflint — 2021-02-25T04:49:30Z

Its still on localhost :frowning: Standard Docker PHP 7.3 stack which I’ve used on previous Bedrock + Sage projects.

In fact I copied over my dockerfile + related files into this new project, but grabbed latest Bedrock + Sage… enabled the theme and there there error was…

---

## Post 4 by @markusflint — 2021-02-25T10:29:36Z

@MWDelaney is there a way I can step through what is being injected into `wp_head` so I can toggle stuff on + off until the problem is resolved?

Seems Sage9 is injecting something onto that, which is causing this, I just don’t know how to narrow down onto exactly what… :confused:

---

## Post 5 by @strarsis — 2021-02-25T11:31:04Z

The actual line from which the PHP Notice is emitted:

> <https://github.com/WordPress/WordPress/blob/5.6.2/wp-includes/general-template.php#L1200>

---

## Post 6 by @markusflint — 2021-02-25T11:51:06Z

removing `add_theme_support('title-tag');` from `app/setup.php:40` removes the error

But this doesn’t seem like it should be necessary? :thinking:

---

## Post 7 by @strarsis — 2021-02-25T12:48:47Z

Does this function (after you re-enabled the title-tag theme feature) in your theme somehow return an array when the PHP notice is thrown?

> <https://github.com/roots/sage/blob/36937b4ceafb9b3c5b705be2ad6f75bc77a9efce/app/View/Composers/Post.php#L37>

Edit: But line 1200 (as previously linked) seems to involve the page numbers.

---

## Post 8 by @markusflint — 2021-02-25T14:45:10Z

1. I ran `composer create-project roots/sage` a couple days ago, and yet it installed `9.0.9` instead of `9.0.10`?
2. in any event, no when I remove that `public static function title()` function, the error remains… doesn’t seem to have to do with anything relating to that…

---

## Post 9 by @strarsis — 2021-02-25T15:11:22Z

Btw. for Sage 9 there is an update branch in progress that fixes a lot of problems, notably with the webpack build:

> [@Sage "9.1": Please test](https://discourse.roots.io/t/sage-9-2-please-test/20067/8):
>
> This is primarily meant for updating existing Sage 9 themes so they build again properly (newer node and npm versions). Updating should be easy as most what is changed consists of “glue” code. Then there are some devs that have familiarized with Sage 9 and are still learning Sage 10 (notably the webpack and acorn part), hence they will still start new theme projects with Sage 9.

As you are working in a development environment, could you either debug (e.g. VSCode breakpoint with XDebug or just a good old `var_dump(...); exit;` this particular line (1200) in the WordPress core code of the site (`(web/)wp/wp-includes/general-template.php` in Bedrock sites)?  
[https://github.com/WordPress/WordPress/blob/5.6.2/wp-includes/general-template.php#L1200](https://github.com/WordPress/WordPress/blob/5.6.2/wp-includes/general-template.php#L1200)

What are the values of `$paged` and `$page`? Are these integers, strings or arrays?  
Any plugins enabled?

---

## Post 10 by @markusflint — 2021-02-25T15:49:09Z

would that 9.2 upgrade also fix the controller not sending data to the view?

:frowning_face:

 ![sage](https://discourse.roots.io/uploads/default/original/2X/3/3f1ac7afc8b9d2aea214d92df30f336ee30d35d5.jpeg)

---

## Post 11 by @markusflint — 2021-02-25T15:51:19Z

> [@strarsis](#):
>
> `var_dump(...); exit;`

the dump returns

![image](https://discourse.roots.io/uploads/default/original/2X/9/93da2d7eac41ef04370c6f2ca2e16a164430b23f.png)

---

## Post 12 by @markusflint — 2021-02-25T16:02:44Z

@strarsis FYI when using the provided command for 9.2, i get:

```
composer create-project roots/sage foobar-test dev-webpack5 --repository='{"type":"vcs","url":"https://github.com/strarsis/sage"}'
Creating a "roots/sage" project at "./mobile-guardian"
GitHub API limit (0 calls/hr) is exhausted, could not fetch https://api.github.com/repos/strarsis/sage/contents/composer.json?ref=7e8f3ae346409f9f6eae68a32c4a75b818b9cbe4. Create a GitHub OAuth token to go over the API rate limit. You can also wait until ? for the rate limit to reset.`
```

---

## Post 13 by @strarsis — 2021-02-25T16:26:02Z

Ah right, you should set up a GitHub access token for your tools. This is a good idea anyway as it doesn’t cost anything and lifts the existing GitHub API quotes to normal user levels.

So the string is `Page Array`. This is quite a good indication that the page number (it should probably be `Page 1` for example instead) is actually an array, which it shouldn’t be or at least further processed by a filter into something that can be cast to a string (what WordPress core expects). Can you also debug/print the page number related variables (as linked above in the WP core code)?

---

## Post 14 by @markusflint — 2021-02-25T17:09:35Z

> [@MWDelaney](#):
>
> I kind of wonder if this is a hosting issue.

@MWDelaney FYI, thanks to @strarsis’s help with debugging this, **installing Yoast SEO fixed the problem** … I assume the default way that WP returns the title as an array which Yoast or similar knows how to handle, but Sage doesn’t?

I’m no expert, but just thought I’d share in case it helps identify a bug somewhere :slight_smile:

---

## Post 15 by @markusflint — 2021-02-25T17:11:11Z

Thanks for your help again @strarsis :fist_right::fist_left:

Whilst I have you, would you mind checking that screenshot I posted about the controller not sending data to the template view? Am I doing something stupid there?

---

## Post 16 by @strarsis — 2021-02-25T17:11:36Z

When you disable Yoast SEO plugin and use the WordPress default theme (Twenty-Twenty-One), would this error still occur?

It seems indeed that Sage needs to add a line or two to handle arrays in the page number.

---

## Post 18 by @markusflint — 2021-02-25T17:35:59Z

> [@strarsis](#):
>
> When you disable Yoast SEO plugin and use the WordPress default theme (Twenty-Twenty-One), would this error still occur?

Yes this was my scenario… IE my brand new, out the box install, had this issue. I confirmed it was the theme, by switching to one of the default themes.

---

## Post 19 by @strarsis — 2021-02-25T20:08:22Z

Hm, shouldn’t rather so called “View Composers” be used in Sage 10 (instead of the classic sober controllers)?  
[https://roots.io/working-with-composers-in-sage-10/](https://roots.io/working-with-composers-in-sage-10/)

---

## Post 20 by @system — 2021-04-07T18:41:44Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
