Git Product home page Git Product logo

apix's People

Contributors

frqnck avatar jspalink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apix's Issues

Problem in Exception.php with shutdownHandler()

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.

Error in Apix\Exception

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

403 “Not a valid CORS request.”

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).

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.