-1

i have been working on a librery proyect with slim4. i realized a merge from github and the the proyect broke. the error is : Fatal error: Type of Sapphirecat

Fatal error: Type of Sapphirecat\Slim4HttpInteropAdapter\GuzzlePsr7v1Factory::$responseFactoryClass must be string (as in class Slim\Factory\Psr17\Psr17Factory) in C:\xampp\htdocs\libreria_alejandria\vendor\sapphirecat\slim4-http-interop-adapter\src\GuzzlePsr7v1Factory.php on line 14

i have reinstalled the slim requirements, but i get the same

said21
  • 1
  • 1
    Restore the last known good configuration and the error should be gone. If that is - for some unfortunate circumstances - not a n option, contact the author of the library and negotiate the conditions of your support options. – hakre Nov 11 '22 at 20:44
  • "i realized a merge from github and the the proyect broke" - why not revert that merge? Why not use any kind of CI pipeline that checks your application for issues before merging? – Nico Haase Nov 12 '22 at 13:41

1 Answers1

-2

As you await a fix from the vendor, Temporarily edit the file GuzzlePsr7v1Factory.php from

    /** @var string */
    protected static $responseFactoryClass = 'Http\Factory\Guzzle\ResponseFactory';
    /** @var string */
    protected static $streamFactoryClass = 'Http\Factory\Guzzle\StreamFactory';
    /** @var string */
    protected static $serverRequestCreatorClass = 'GuzzleHttp\Psr7\ServerRequest';
    /** @var string */
    protected static $serverRequestCreatorMethod = 'fromGlobals';

to

    /** @var string */
    protected static string $responseFactoryClass = 'Http\Factory\Guzzle\ResponseFactory';
    /** @var string */
    protected static string $streamFactoryClass = 'Http\Factory\Guzzle\StreamFactory';
    /** @var string */
    protected static string $serverRequestCreatorClass = 'GuzzleHttp\Psr7\ServerRequest';
    /** @var string */
    protected static string $serverRequestCreatorMethod = 'fromGlobals';

i.e. add string after static of each of the class members.

Pilling Fine
  • 143
  • 9
  • Editing files in the `vendor` directory is never a good idea – Nico Haase Nov 15 '22 at 07:18
  • Keyword `Temporarily`. As he waits for fix from the vendor – Pilling Fine Nov 16 '22 at 12:07
  • 1
    Feel free to add all clarification to your answer by editing it – Nico Haase Nov 16 '22 at 12:09
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 17 '22 at 20:14