Upgrade - call to undefined method error

Hi,

Just trying to upgrade my website to silverstripe 4 from 3, but getting this issue:

Fatal error: Call to undefined method SilverStripe\Core\Convert::slashes() in /var/www/src/vendor/silverstripe/assets/src/Flysystem/PublicAssetAdapter.php on line 67

Anyone know what this could be?

Ah, yes that means that you’ve downloaded a version that is compatible with PHP7 only - that : is a typehint syntax.

You’ll need php-intl regardless, so definitely install that and definitely use composer - it totally solves all of your compatibility headaches. If necessary, I’d even recommend starting from a blank SS4 install (check out the recipe documentation) and then adding the custom code and modules back in.

1 Like

Yeah think i’m going to take that route - just installing php-intl as we speak.

Thanks for your help - apprecaite it

Regards

2 Likes

I’ve installed silverstripe fresh from composer now with no old files, installed fine but when I log into the CMS, I fill out the details and password but this error comes up:

Website Error

There has been an error

The website server has not been able to respond to your request

You’ll need to make sure that the site is in dev mode and check your logs for that one - it could be almost anything :slight_smile:

I’ve put it in dev mode and checked my error logs but doesn’t quite explain anything for me, this is the only relevant error I have;

[Thu Mar 15 11:51:32.291377 2018] [core:error] [pid 971:tid 140516624623360] [client 192.168.81.1:65273] AH00037: Symbolic link not allowed or link target not accessible: /var/www/src/resources/silverstripe/framework/client/styles, referer: http://www.basestripe.pixel/Security/login/default/LoginForm/

Okay finally got the error to show (getting used to SS4), this seems to be the error - done from a fresh install via composer:

[Recoverable Error] Argument 1 passed to SilverStripe\Config\MergeStrategy\Priority::mergeArray() 
must be of the type array, string given, called in /var/www/src/vendor/silverstripe/framework/src/Core/Config/Middleware/InheritanceMiddleware.php 
on line 43 and defined```

OK, that means your config has a string where it should have an array. Can you paste your config.yml files?

Config.yml file:

---
Name: mysite
SilverStripe\Core\Manifest\ModuleManifest:
project: mysite
---

File:
allowed_extensions:
- svg
Image:
allowed_extensions:
- svg

App.yml file:

Silverstripe\SiteConfig\SiteConfig:
SiteConfig:
extensions:
- CustomSiteConfig

mysite.yml file:

---
Name: myproject
---
SilverStripe\Core\Manifest\ModuleManifest:
project: mysite

theme.yml:

theme.yml:

---
Name: mytheme
---
SilverStripe\View\SSViewer:
themes:
- ‘$public’
- ‘simple’
- ‘$default’
SilverStripe\i18n\i18n:
default_locale: ‘en_GB’

First thing I can see is that File and Image need to be correctly namespaced in Config.yml

Okay finally got rid of that error now, now I have this error when trying to login :cry::cry:

[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: 
Couldn't run query: SELECT DISTINCT count(DISTINCT "LoginAttempt"."ID") 
AS "Count" FROM "LoginAttempt" WHERE (("LoginAttempt"."Email" = ?) OR 
("LoginAttempt"."EmailHashed" = ?)) 42S22-1054: Unknown column
'LoginAttempt.EmailHashed' in 'where clause'

Run a dev/build and flush? That column should be there in the output of the dev/build.

Just done a dev/build & flush, might be because i’m using a SS3.1 DB on my virtual machine?

[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: 
Couldn't run query: ALTER TABLE "Page_Versions" RENAME "_obsolete_Page_Versions" 
42S02-1146: Table 'silverstripe.Page_Versions' doesn't exist

GET /dev/build?flush=all&flushtoken=ed4c5b7e3906aab362cf5e2247b2cfd9

Line  **64**  in  **/var/www/src/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php**

Yeah, don’t mix the databases if you can avoid it. The upgrader tool should migrate tables across, but you are almost better off starting with a fresh DB, cos the tables don’t match one to one. Versions != versions, for example :slight_smile:

1 Like

Finally got it all installed now, appreciate all your help massively ! legend

2 Likes

What version are you upgrading from and to, exactly? Can you check that vendor/silverstripe/framework/src/Core/Convert.php is present?

Hi,

Yes that file is present - upgrading from version 3.1 to 4.0.

Regards

Alright, 3.1 to 4 is a big jump. Are you upgrading via composer? And is the method definitely there on that file? And finally, have you run a flush and a dev/build?

I upgraded by downloading from SS site and replacing my current base build, just ran a dev/build and worked correctly but still getting that issue:

[Alert] Call to undefined method SilverStripe\Core\Convert::slashes()

GET /?isDev=1&isDevtoken=0cf6ed590e5c9a602a159579ef97fa58

Line  **67**  in  **/var/www/src/vendor/silverstripe/assets/src/Flysystem/PublicAssetAdapter.php**

also getting this error: ( ! ) Parse error: syntax error, unexpected ':', expecting ';' or '{' in /var/www/src/vendor/symfony/filesystem/Filesystem.php on line *732*

Could it be because i’m not installing via composer? I did try to upgrade via composer but was getting this error:

silverstripe/framework 4.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.

Regards

You need PHP-INTL no matter which way you upgrade. The suggested way however, would still be composer. Installing PHP-INTL on to your PHP installation isn’t that complex and it’s needed for SilverStripe 4.