PHP Classes

Type error

Recommend this page to a friend!

      Nanobase  >  All threads  >  Type error  >  (Un) Subscribe thread alerts  
Subject:Type error
Summary:TypeError in nanobase.php
Messages:2
Author:Randy Brachman
Date:2022-12-08 01:24:10
 

  1. Type error   Reply   Report abuse  
Picture of Randy Brachman Randy Brachman - 2022-12-08 01:24:11
Not sure if this is where to post my issue, but...

This code (line 9):
$db->make(['field1' => 'aaaa','field2' => 'John']);

gives this result:

Fatal error: Uncaught TypeError: Unsupported operand types: string + int in F:\...\...\Nanobase.php:923 Stack trace: #0 F:\...\...\test1.php(9): Nanobase->make(Array) #1 {main} thrown in F:\...\...\Nanobase.php on line 923

My search says this is PHP 8 issue (I'm on PHP Version 8.1.6): "The error ... only occurs on PHP 8 and it is because you're trying to add a string to an integer.

  2. Re: Type error   Reply   Report abuse  
Picture of Sheldon Kennedy Sheldon Kennedy - 2022-12-08 03:01:05 - In reply to message 1 from Randy Brachman
Hi Randy,

Thanks for posting this. It looks like something straightforward to fix. Could you send me the rest of your code so I can get the context of where the problem is coming in?

sheldonkennedy@gmail.com

Thanks
Sheldon