IMPORTANT: Extra step required when upgrading to v4.3

After upgrading to v4.3 you may need to manually delete bootstrap/cache/compiled.php, if you’re using composer the file will be automatically deleted.

Hi Hillel.

First I overwrite all the files with 4.3

Whoops, looks like something went wrong.
1/1
FatalThrowableError in compiled.php line 11913:
Call to undefined method Illuminate\Database\MySqlConnection::setFetchMode()
in compiled.php line 11913
at DatabaseManager->prepare(object(MySqlConnection)) in compiled.php line 11866
at DatabaseManager->connection() in compiled.php line 11966
at DatabaseManager->__call('listen', array(object(Closure))) in LaravelDebugbar.php line 334
at LaravelDebugbar->boot() in LaravelDebugbar.php line 109
at LaravelDebugbar->enable() in ServiceProvider.php line 111
at ServiceProvider->boot()
at call_user_func_array(array(object(ServiceProvider), 'boot'), array()) in compiled.php line 1375
at Container->call(array(object(ServiceProvider), 'boot')) in compiled.php line 2036
at Application->bootProvider(object(ServiceProvider)) in compiled.php line 2028
at Application->Illuminate\Foundation\{closure}(object(ServiceProvider), '13')
at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FoundationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(NotificationServiceProvider), object(BootstrapperL5ServiceProvider), object(ServiceProvider), object(ImageServiceProvider), object(CountriesServiceProvider), object(SwaggervelServiceProvider), object(ExcelServiceProvider), object(CloudStorageServiceProvider), object(LaravelCrawlerDetectServiceProvider), object(UpdaterServiceProvider), object(ConsoleServiceProvider), object(ContractsServiceProvider), object(LaravelModulesServiceProvider), object(ServiceProvider), object(DatatableServiceProvider), object(AuthServiceProvider), object(AppServiceProvider), object(ComposerServiceProvider), object(ConfigServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(LaravelPushNotificationServiceProvider), object(HashServiceProvider)), object(Closure)) in compiled.php line 2029
at Application->boot() in compiled.php line 2368
at BootProviders->bootstrap(object(Application)) in compiled.php line 1796
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in compiled.php line 2568
at Kernel->bootstrap() in compiled.php line 2518
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2503
at Kernel->handle(object(Request)) in index.php line 51

When I delete the bootstrap/cache/compiled.php

Whoops, looks like something went wrong.
(1/1) Exception
DateTime::__construct(): Failed to parse time string (2018-04-08 13:45:22.-746400) at position 24 (4): Unexpected character

in Carbon.php (line 408)
at DateTime->__construct('2018-04-08 13:45:22.-746400', object(DateTimeZone))
in Carbon.php (line 408)
at Carbon->__construct('2018-04-08 13:45:22.-746400', null)
in Carbon.php (line 457)
at Carbon::now()
in VerifyCsrfToken.php (line 158)
at VerifyCsrfToken->addCookieToResponse(object(Request), object(Response))
in VerifyCsrfToken.php (line 65)
at VerifyCsrfToken->handle(object(Request), object(Closure))
in VerifyCsrfToken.php (line 44)
at VerifyCsrfToken->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in ShareErrorsFromSession.php (line 49)
at ShareErrorsFromSession->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in StartSession.php (line 64)
at StartSession->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in AddQueuedCookiesToResponse.php (line 37)
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in EncryptCookies.php (line 59)
at EncryptCookies->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Router.php (line 574)
at Router->runRouteWithinStack(object(Route), object(Request))
in Router.php (line 533)
at Router->dispatchToRoute(object(Request))
in Router.php (line 511)
at Router->dispatch(object(Request))
in Kernel.php (line 176)
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
in Pipeline.php (line 30)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Debugbar.php (line 51)
at Debugbar->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in CheckForMaintenanceMode.php (line 46)
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in HandlePreflight.php (line 46)
at HandlePreflight->handle(object(Request), object(Closure))
in Pipeline.php (line 148)
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
in Pipeline.php (line 53)
at Pipeline->Illuminate\Routing\{closure}(object(Request))
in Pipeline.php (line 102)
at Pipeline->then(object(Closure))
in Kernel.php (line 151)
at Kernel->sendRequestThroughRouter(object(Request))
in Kernel.php (line 116)
at Kernel->handle(object(Request))
in index.php (line 51)

What am I doing wrong? I’m simply overwriting all files like always.

Br,
Dali

It may be related to this issue, we’ll create a dot release later today with the updated version of Carbon.

https://github.com/invoiceninja/invoiceninja/issues/2010

It works after I updated Carbon.php like the link suggests.

Should that be it or I rather wait for dot release?

Br,
Dali

It’s the only change we plan on including in the dot release.

I installed 4.3.1 but I still have the same issue! So the dot release didn’t fix this issue if your are upgrading from v4.2.x.

Edit:
I removed bootstrap/cache/compiled.php. Opening invoiceninja in the browser directly redirected to /update URL. But that one failed because of permissions. So u ran the *.sh update script again from ssh and now I think it is working.

Can you clarify, which error are you seeing?

See my answer above, didn’t copy the exact error message. But had something to do with the update process and permissions in tmp folder.

Just running the update 4.3.1 gave me exact the same error as mentioned above (https://www.invoiceninja.com/forums/topic/important-extra-step-required-when-upgrading-to-v4-3/#post-13189)

Glad to hear it’s working!

The fix was for the Carbon issue, users upgrading to v4.3 may still need to manually delete bootstrap/cache/compiled.php

Hello everyone,

I have upgraded to 4.3.1 and did the and deleted ‘complied.php’. It works for the most part but I get the below error when running ‘my_site/update’

SQLSTATE[HY000]: General error: 1005 Can't create table 'DATABASE-NAME.#sql-7e6e7_3722e8' (errno: 121) (SQL: alter tableactivitiesadd constraintactivities_client_id_foreignforeign key (client_id) referencesclients(id) on delete cascade)

I can login and use the system, but I haven’t tested all parts to see what this maybe affecting.

Regards.

Have you manually deleted data from the database in the past?

No I haven’t.

The migration is failing because there are rows in the activities table with a client_id which doesn’t exist in the clients table. The only cause for this that I’m aware of is a client being manually deleted from the database.

To fix it you’d need to delete the relevant rows in the activities table, comment out the first few lines of the 2018_03_08_150414_add_slack_notifications migration and then load /update.

Ok I see. I have never touched the database other than to back it up.

I have 4 records in the ‘activities’ table whit a ‘client_id’ of ‘null’ maybe these are the cause.

I don’t think they’re the problem.

Some activities (ie, creating a task) may not have a client id set.

I don’t have much clients so I add each id I find in the activities table to the “/clients/id” URL to see if the get an actual client. Would that work? just to single out what exist.

Try running this SQL query:

select a.id, a.created_at, c.id, a.activity_type_id, a.adjustment
from activities a
left join clients c on c.id = a.client_id
where a.client_id > 0
and c.id is null;

All of my client ids worked on the URL and the query returned zero results

It looks like error 121 could be caused by the foreign key already existing. If you want to email a backup of your database from before the upgrade to contact@invoiceninja.com I can try to debug the problem.