frqnck / apix Goto Github PK
View Code? Open in Web Editor NEWRESTful API server for structured and self-documenting resources over JSON, XML, ...
Home Page: http://frqnck.github.io/apix
License: Other
RESTful API server for structured and self-documenting resources over JSON, XML, ...
Home Page: http://frqnck.github.io/apix
License: Other
Not sure the best way to fix as I haven't spent any time messing with it yet, but figure you have a good idea of how to solve this. It might be as simple as turning the DEBUG constant here to "false".
If there is an error in an internal function (database query, json_encode, etc) and it is caught and handled appropriately by the user, error_get_last() still returns the error. This means that we can intend to return an appropriate response to the user, but it will have a 500 appended (in HTML) to the response.
The parameters for Apix\Exception::errorHandler are incorrect. The final parameter $ctx
should be \Exception $e
, the previous Exception that is passed along with it. As it currently stands, the following error is passed, and can be replicated with the following code:
php > throw new ErrorException("an oops occurred", 400, 0, 'somefile', 10, array());
PHP Fatal error: Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]]) in php shell code on line 1
PHP Stack trace:
PHP 1. {main}() php shell code:0
PHP 2. ErrorException->__construct() php shell code:1
Fatal error: Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]]) in php shell code on line 1
Call Stack:
336.6461 239752 1. {main}() php shell code:0
336.6462 240640 2. ErrorException->__construct() php shell code:1
An empty array, BTW, is what is getting passed in, but I'm not sure where from - the error code that I'm seeing doesn't give me a clear indication of where it is. The error code from the API I'm working on looks like this:
Fatal error: Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]]) in /home/jspalink/dev/info-econtext-api/vendor/apix/apix/src/php/Apix/Exception.php on line 36
Call Stack:
0.0001 239728 1. {main}() /home/jspalink/dev/info-econtext-api/public/index.php:0
0.0070 1011240 2. Apix\Main->run() /home/jspalink/dev/info-econtext-api/public/index.php:12
0.0260 1241392 3. Apix\Response->generate() /home/jspalink/dev/info-econtext-api/vendor/apix/apix/src/php/Apix/Main.php:201
0.0260 1242144 4. Apix\Exception::errorHandler() /home/jspalink/dev/info-econtext-api/vendor/apix/apix/src/php/Apix/Main.php:391
0.0261 1249280 5. ErrorException->__construct() /home/jspalink/dev/info-econtext-api/vendor/apix/apix/src/php/Apix/Exception.php:36
<h1>500 Internal Server Error</h1>#1 Shutdown:- Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]]) @ /home/jspalink/dev/info-econtext-api/vendor/apix/apix/src/php/Apix/Exception.php:36
Obviously, there is no /apix/apix/src/php/Apix/Main.php:391
The APIx composer.json file has a requirement for "apix/log 1.0.*" - requiring new versions of apix/log in a project downgrades apix to 0.3.5.
It is (probably) not strictly correct for the CORS plugin to return a 403 “Not a valid CORS request.”.
The Web browser really should make that decision rather than the API?
Although, this 403 is currently serving us well and may deter the ‘scrapping’ kids…
TODO: Check against https://www.w3.org/TR/cors/
Maybe make this an optional feature?
Somehow that 403 may affect JSONP request, legacy browser probably don’t follow same origin policy anyway. Currently, JSONP requests require to disable the CORS plugin (using the _no_cors
param).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.