# get_magic_quotes_gpc() returns false instead of 0

- Thread: https://externals.io/message/60281
- Original archive: https://news-web.php.net/php.internals/60281
- Started by Philip Olson on 2012-04-24T15:29:27+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #60281 — Philip Olson — 2012-04-24T15:29:27+00:00

URL: https://externals.io/message/60281#60281

Hello everyone,

The following bug report brings up a good point:

  https://bugs.php.net/61784

The get_magic_quotes_gpc() function returns 0/1 before 5.4, but now 
it returns boolean false. Instead it should return 0. Fixing this 
feels like a bug fix, which would go in 5.4.1. Thoughts?

Regards,
Philip

---

## #60283 — Paul Dragoonis — 2012-04-24T16:11:24+00:00

URL: https://externals.io/message/60281#60283 · In reply to: #60281

Happy to patch this once someone confirms this is a bug and not
"changed behaviour" in 5.4.

- Paul.


> Hello everyone,
>
> The following bug report brings up a good point:
>
>  https://bugs.php.net/61784
>
> The get_magic_quotes_gpc() function returns 0/1 before 5.4, but now
> it returns boolean false. Instead it should return 0. Fixing this
> feels like a bug fix, which would go in 5.4.1. Thoughts?
>
> Regards,
> Philip

---

## #60284 — Stas Malyshev — 2012-04-24T16:43:10+00:00

URL: https://externals.io/message/60281#60284 · In reply to: #60281

Hi!

>   https://bugs.php.net/61784
> 
> The get_magic_quotes_gpc() function returns 0/1 before 5.4, but now 
> it returns boolean false. Instead it should return 0. Fixing this 
> feels like a bug fix, which would go in 5.4.1. Thoughts?

I do not see a reason to hold 5.4.1 for this.


-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #60295 — keisial@gmail.com — 2012-04-24T21:51:07+00:00

URL: https://externals.io/message/60281#60295 · In reply to: #60283

> Happy to patch this once someone confirms this is a bug and not
> "changed behaviour" in 5.4.
>
> - Paul.
Why would such behavior change be desired?
get_magic_quotes_gpc() is kept only for compatibility with scripts which
did magic quote detection.

As such, it should return its 'traditional' value.

get_magic_quotes_gpc() got wrongly deprecated in 5.4, then restored...
I think that when implementing it to always return that there are no
magic_quotes,
it was just inadvertedly changed to false. Which is the "logical" thing
as those 0/1 work as
booleans, but that should have been done long ago, when designing it,
not now.

Regards

---

## #60298 — Philip Olson — 2012-04-24T22:25:59+00:00

URL: https://externals.io/message/60281#60298 · In reply to: #60284

> Hi!
> 
> > […]
> 
> I do not see a reason to hold 5.4.1 for this.

The less people beginning to rely on this bug the better, and this is
a critical time. The impact of this BC break feels larger considering 
MQ is enabled by default in PHP 5.3 and below.

This change shouldn't damage the RC QA process as all this does (tm) 
is change the return of false to 0. And considering that the magic 
quotes feature is removed, this change should not affect other code.

Oh, sometimes it's nice that more people use == versus ===. ;)

Regards,
Philip

---

## #60303 — Stas Malyshev — 2012-04-24T23:46:36+00:00

URL: https://externals.io/message/60281#60303 · In reply to: #60298

Hi!

> The less people beginning to rely on this bug the better, and this is
> a critical time. The impact of this BC break feels larger considering 
> MQ is enabled by default in PHP 5.3 and below.

I understand but a) nobody should be using magic quotes anyway and b)
holding release for 5.4.1 because of a very minor issue with easy
workaround doesn't seem productive for me. If we hold release for each
such thing, we'll never have 5.4.1 at all.

> This change shouldn't damage the RC QA process as all this does (tm) 
> is change the return of false to 0. And considering that the magic 
> quotes feature is removed, this change should not affect other code.

Code change means we can't release. I'm not comfortable putting untested
code in the release. We'll get it in 5.4.2.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #60305 — Philip Olson — 2012-04-25T00:29:11+00:00

URL: https://externals.io/message/60281#60305 · In reply to: #60303

> Hi!
> 
> > […]
> 
> I understand but a) nobody should be using magic quotes anyway and b)
> holding release for 5.4.1 because of a very minor issue with easy
> workaround doesn't seem productive for me. If we hold release for each
> such thing, we'll never have 5.4.1 at all.

I don\'t understand why get_magic_quotes_gpc() and get_magic_quotes_runtime()
get such a bad wrap. People using these functions are not using magic
quotes, but instead they (most) are writing code that will work in environments
that have it enabled. This helps code work in PHP 5.4 and below, as opposed 
to only PHP 5.4 and above.

And yes, the number of people that use \"=== false\" here is small I reckon.
But this is a BC break in a BC function. Something feels very wrong about 
that.

So I understand that we cannot hold a release for every bug and that we 
have known bugs in every release, but will we revert this change after it
exists in two PHP releases? Whatever the case, this also means we\'ll have 
to document this change… and here I was trying to be lazy. :)

Regards,
Philip
