PHPackages                             yidas/magic-quotes-gpc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yidas/magic-quotes-gpc

ActiveProject[Utility &amp; Helpers](/categories/utility)

yidas/magic-quotes-gpc
======================

Implement magic\_quotes\_gpc on PHP 5.4 above version for legacy code

1.1.0(8y ago)6261MITPHP

Since Sep 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/yidas/php-magic-quotes-gpc)[ Packagist](https://packagist.org/packages/yidas/magic-quotes-gpc)[ Docs](https://github.com/yidas/php-magic-quotes-gpc)[ RSS](/packages/yidas-magic-quotes-gpc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

PHP Magic Quotes Implementation
===============================

[](#php-magic-quotes-implementation)

Implement magic\_quotes\_gpc on PHP 5.4 later version for legacy code

[![Latest Stable Version](https://camo.githubusercontent.com/6808c86ef8ddb88d0d46e079a5b4bf590cd84e129bbfe4933d4c9dd24e64c299/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f6d616769632d71756f7465732f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/magic-quotes)[![Latest Unstable Version](https://camo.githubusercontent.com/7b648fe01cdece38465788cb37fe53a34c0e23affaa14853deb0e505d52ee012/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f6d616769632d71756f7465732f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/magic-quotes)[![License](https://camo.githubusercontent.com/1922630ca7c40270abaf9ec955d3d0d213c332e5c4d8f7a1cce2ab9f1dbbee31/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f6d616769632d71756f7465732f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/magic-quotes)

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

As PHP's Warning for [Magic Quotes](http://php.net/manual/en/security.magicquotes.php):

> Magic Quotes feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

---

DEMONSTRATION
-------------

[](#demonstration)

```
print_r($_GET);
MagicQuotesGpc::init();
print_r($_GET);
```

After visiting URL with query `?username=1' OR '1'='1`, and the output will be:

```
Array ( [username] => 1' OR '1'='1 )
Array ( [username] => 1\' OR \'1\'=\'1 )

```

### Recursive Input Data Concern

[](#recursive-input-data-concern)

The recursive data input from `$_POST`, `$_COOKIE` even `$_GET` will be handled also:

```
$_POST['users'][0] = ['username'=>"1' OR '1'='1"];
print_r($_POST);
MagicQuotesGpc::init();
print_r($_POST);
```

After simulating `$_POST` data assignment, the output will be:

```
Array ( [users] => Array ( [0] => Array ( [username] => 1' OR '1'='1 ) ) )
Array ( [users] => Array ( [0] => Array ( [username] => 1\' OR \'1\'=\'1 ) ) )

```

---

INSTALLATION
------------

[](#installation)

### Install via Composer

[](#install-via-composer)

Run Composer in your legacy project:

```
composer require yidas/magic-quotes

```

Then initialize it at the bootstrap of application such as `config` file:

```
require __DIR__ . '/vendor/autoload.php';
MagicQuotesGpc::init();
```

### Install Directly by Loading Class

[](#install-directly-by-loading-class)

Load the `MagicQuotesGpc.php` and initialize it:

```
require __DIR__ . '/MagicQuotesGpc.php';
MagicQuotesGpc::init();
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~199 days

Total

2

Last Release

2968d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b30d2b2c0b53aef65fad4af56cd3c7912d3db2b612890c706fe79448717f6aba?d=identicon)[yidas](/maintainers/yidas)

---

Top Contributors

[![yidas](https://avatars.githubusercontent.com/u/12604195?v=4)](https://github.com/yidas "yidas (3 commits)")

---

Tags

legacy-codemagic-quotesphpphp54SQL InjectionLegacy codeMagic Quotes

### Embed Badge

![Health badge](/badges/yidas-magic-quotes-gpc/health.svg)

```
[![Health](https://phpackages.com/badges/yidas-magic-quotes-gpc/health.svg)](https://phpackages.com/packages/yidas-magic-quotes-gpc)
```

###  Alternatives

[robicch/jquery-gantt

Twproject Gantt editor is a free online tool for creating and sharing Gantts

2.3k157.7k](/packages/robicch-jquery-gantt)[brickrouge/brickrouge

A toolkit to create HTML elements

301.8k6](/packages/brickrouge-brickrouge)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
