Giter Site home page Giter Site logo

tysonandre / var_representation Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 112 KB

var_representation() : readable alternative to var_export() in PHP

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.52% PHP 82.70% Shell 3.61% M4 2.11% C 11.06%
php pecl

var_representation's People

Contributors

remicollet avatar tysonandre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

remicollet

var_representation's Issues

Idea: `var_representation_decode(string, array|bool $allowed_classes = [])` - similar to eval() but constraining what can be done

  • Support php 8.1 enums
  • Support (object)[] for stdClass
  • Support __set_state for classes in $allowed_classes
  • Support [] and array() arrays with keys/values
  • Support decoding the output of var_export
  • Reject "$var"
  • Reject expression types not found in var_export/var_representation (e.g. ['a'][0])

Reasons:

  • eval/unserialize can have unexpected side effects and should not be used on untrusted inputs
  • json_decode can't support mixes of associative arrays and objects (or empty arrays and empty objects)
  • Support binary data, unlike json_decode

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.