Closed saracomin96 closed 11 months ago
What version are you using, can you please try to install the latest version with:
composer require onpage-dev/onpage-php:^v1.1
hi, thanks for the reply! I updated to the latest version but unfortunately the problem persists, what else could I check?
I also tried locally with a composer project but it still doesn't work
Can you send me the updated error backtrace?
In your log i can see the error is at Thing.php(35)
, but that line contains a comment, not code, therefore it must refer to an older version.
Fatal error: Uncaught TypeError: OnPage\Thing::values(): Return value must be of type Illuminate\Support\Collection, array returned in /nas/content/live/websitestg/wp-content/themes/astra-child/my-project/vendor/onpage-dev/onpage-php/src/Thing.php:61 Stack trace: #0 /nas/content/live/websitestg/wp-content/themes/astra-child/my-project/vendor/onpage-dev/onpage-php/src/Thing.php(35): OnPage\Thing->values('codice_paraf', NULL, Object(OnPage\Field)) #1 /nas/content/live/websitestg/wp-content/themes/astra-child/functions.php(323): OnPage\Thing->val('codice_paraf')
Same error, Am I doing something wrong in downloading the updated version of the library?
I think so, can you try to remove and re-install the library?
composer remove onpage-dev/onpage-php
composer require onpage-dev/onpage-php:^v1.1
Done but still the same error
Fatal error: Uncaught TypeError: OnPage\Thing::values(): Return value must be of type Illuminate\Support\Collection, array returned in C:\Users\Sara\Desktop\my_project\vendor\onpage-dev\onpage-php\src\Thing.php:61 Stack trace: #0 C:\Users\Sara\Desktop\my_project\vendor\onpage-dev\onpage-php\src\Thing.php(35): OnPage\Thing->values('codice_paraf', NULL, Object(OnPage\Field)) #1 C:\Users\Sara\Desktop\my_project\index.php(31): OnPage\Thing->val('codice_paraf') #2 {main} thrown in C:\Users\Sara\Desktop\my_project\vendor\onpage-dev\onpage-php\src\Thing.php on line 61
Thing.php(35) on this line there is this code
return $this->values($field_path, $lang, $field)->first();
complete function
public function val(string $field_path, string $lang = null) //: null | string | bool | int | array | File { return $this->values($field_path, $lang, $field)->first(); }
I managed to solve: I manually downloaded the folder from github and now it works, with the command the latest version is not downloaded
composer require onpage-dev/onpage-php:^v1.1
What is your PHP version? Please send me an email at giacomo.rizzi@onpage.it and we'll follow the discussion there as there must be some error with your mistake.
Normally you should see you are installing version 1.1.79:
Issue was resolved forcing composer to install the latest version.
composer require onpage-dev/onpage-php:^v1.1.79
Hello,
I'm integrating this library to my wordpress site. I have a problem: I use the val() function to retrieve the field values, for some fields it works correctly but for some it generates an error and I don't understand why
this is the error I have, I don't know if it can help to understand:
the fields I use are single values, so I can't understand why it generates this
I also have a problem recovering the image fields, this error is generated:
Below is my complete code:
Am I doing something wrong? To import the library I created a composer project which was then imported into the WordPress file system