{"id":15023582,"url":"https://github.com/yidas/php-magic-quotes-gpc","last_synced_at":"2025-07-03T15:06:23.963Z","repository":{"id":57086862,"uuid":"72719499","full_name":"yidas/php-magic-quotes-gpc","owner":"yidas","description":"Implement magic_quotes_gpc on PHP 5.4 later version for legacy code","archived":false,"fork":false,"pushed_at":"2018-06-08T03:38:27.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T13:06:57.626Z","etag":null,"topics":["legacy-code","magic-quotes","php","php54"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yidas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-03T07:27:05.000Z","updated_at":"2021-03-10T17:36:19.000Z","dependencies_parsed_at":"2022-08-25T00:50:43.920Z","dependency_job_id":null,"html_url":"https://github.com/yidas/php-magic-quotes-gpc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yidas/php-magic-quotes-gpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yidas%2Fphp-magic-quotes-gpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yidas%2Fphp-magic-quotes-gpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yidas%2Fphp-magic-quotes-gpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yidas%2Fphp-magic-quotes-gpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yidas","download_url":"https://codeload.github.com/yidas/php-magic-quotes-gpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yidas%2Fphp-magic-quotes-gpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263348224,"owners_count":23452871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["legacy-code","magic-quotes","php","php54"],"created_at":"2024-09-24T19:59:12.867Z","updated_at":"2025-07-03T15:06:23.893Z","avatar_url":"https://github.com/yidas.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP Magic Quotes Implementation\n===============================\n\nImplement magic_quotes_gpc on PHP 5.4 later version for legacy code\n\n[![Latest Stable Version](https://poser.pugx.org/yidas/magic-quotes/v/stable?format=flat-square)](https://packagist.org/packages/yidas/magic-quotes)\n[![Latest Unstable Version](https://poser.pugx.org/yidas/magic-quotes/v/unstable?format=flat-square)](https://packagist.org/packages/yidas/magic-quotes)\n[![License](https://poser.pugx.org/yidas/magic-quotes/license?format=flat-square)](https://packagist.org/packages/yidas/magic-quotes)\n\nIf you are migrating legacy source code to the enviorment with PHP version 5.4 above, but including lots of vulnerable DB query codes depending on Magic Quotes `magic_quotes_gpc` SQL protection. Just use this to run smoothly on new version PHP like old time.\n\nAs PHP's Warning for [Magic Quotes](http://php.net/manual/en/security.magicquotes.php):\n\n\u003e Magic Quotes feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.\n\n---\n\nDEMONSTRATION\n-------------\n\n```php\nprint_r($_GET);\nMagicQuotesGpc::init();\nprint_r($_GET);\n```\n    \nAfter visiting URL with query `?username=1' OR '1'='1`, and the output will be: \n\n    Array ( [username] =\u003e 1' OR '1'='1 ) \n    Array ( [username] =\u003e 1\\' OR \\'1\\'=\\'1 )\n    \n    \n### Recursive Input Data Concern\n\nThe recursive data input from `$_POST`, `$_COOKIE` even `$_GET` will be handled also:\n\n```php\n$_POST['users'][0] = ['username'=\u003e\"1' OR '1'='1\"];\nprint_r($_POST);\nMagicQuotesGpc::init();\nprint_r($_POST);\n```\n\nAfter simulating `$_POST` data assignment, the output will be: \n\n    Array ( [users] =\u003e Array ( [0] =\u003e Array ( [username] =\u003e 1' OR '1'='1 ) ) ) \n    Array ( [users] =\u003e Array ( [0] =\u003e Array ( [username] =\u003e 1\\' OR \\'1\\'=\\'1 ) ) )\n\n---\n\nINSTALLATION\n------------\n\n### Install via Composer\n\nRun Composer in your legacy project:\n\n    composer require yidas/magic-quotes\n    \nThen initialize it at the bootstrap of application such as `config` file:\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\nMagicQuotesGpc::init();\n```\n\n### Install Directly by Loading Class\n\nLoad the `MagicQuotesGpc.php` and initialize it:\n\n```php\nrequire __DIR__ . '/MagicQuotesGpc.php';\nMagicQuotesGpc::init();\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyidas%2Fphp-magic-quotes-gpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyidas%2Fphp-magic-quotes-gpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyidas%2Fphp-magic-quotes-gpc/lists"}