Git Product home page Git Product logo

neomerx-json-api's People

Contributors

boris-glumpler avatar bravo-kernel avatar efinder2 avatar fordarnold avatar gitter-badger avatar gregpeden avatar hglattergotz avatar lavatoaster avatar liamkarlmitchell avatar lindyhopchris avatar lunika avatar neomerx avatar pablokowalczyk avatar shadowhand avatar x-coder264 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

neomerx-json-api's Issues

Property used before initialisation

I'm upgrading my application to version 6.0.0 of cloud-creativity/laravel-json-api, which includes this package.

I'm getting an error in src/Schema/Error.php. It happens in the laravel exception handler when I'm handling an authentication error - i.e. not a json-api error.

This class has a property $links, which is defined as:

private ?iterable $links;

The constructor initialises it by calling setLink():

public function setLink(string $name, ?LinkInterface $link): self
{
if ($link !== null) {
$this->links[$name] = $link;
} else {
unset($this->links[$name]);
}
return $this;
}

It is then accessed using getLinks():

public function getLinks(): ?iterable
{
return $this->links;
}

The problem is that when the $link parameter to setLink() is null, then the call to unset() doesn't actually initialise the property, and the following error is generated when you call getLink():

Uncaught Error: Typed property Neomerx\\JsonApi\\Schema\\Error::$links must not be accessed before initialization in /Users/gr4376/Projects/nquire/vendor/laravel-json-api/neomerx-json-api/src/Schema/Error.php:152.

AFAICT, the fix is simply to initialise the property:

private ?iterable $links = null;

Framework agnostic?

The original neomerx package was framework agnostic. After the fork, this rep also says it's "framework" agnostic in the info panel. However, the repo title suggests it is Laravel only. Which is correct? And if it's Laravel only, why was that change made?

Encoder adds null meta despite interface saying it will not be added

The description for withMeta() on the EncoderInterface says:

Add meta information that will be encoded with data. If 'null' meta will not appear in a document.

However the encoder does include meta as null if you call Encoder::withMeta(null). The bug is in the EncoderPropertiesTrait.

Error with Psr\Log\LoggerInterface declaration

Hi,

When I try to run my installation I get this error:

Declaration of Neomerx\JsonApi\Factories\Factory::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void

I am using this library via: "cloudcreativity/laravel-json-api": "4.*"

Thanks in advance, Regards!

Error when using PHP 8.1

When using this package with PHP 8.1 I am getting the following error:

[Error] Typed property Neomerx\JsonApi\Schema\Error::$links must not be accessed before initialization in 

/var/www/html/vendor/laravel-json-api/neomerx-json-api/src/Schema/Error.php on line 152

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.