Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update namespace FAQ on overriding special constants #3055

Merged

Conversation

haszi
Copy link
Contributor

@haszi haszi commented Jan 1, 2024

Removed ZEND_THREAD_SAFE and ZEND_DEBUG_BUILD from the section about defining namespaced special, built-in constants resulting in a fatal error as this is no longer the case for these two.

This code (https://3v4l.org/iMP1P)

<?php
namespace bar;
const ZEND_DEBUG_BUILD = true;
const ZEND_THREAD_SAFE = true;

var_dump(\ZEND_DEBUG_BUILD);
var_dump(\ZEND_THREAD_SAFE);

var_dump(ZEND_DEBUG_BUILD);
var_dump(ZEND_THREAD_SAFE);

no longer results in a fatal error but in this output

bool(false)
bool(false)
bool(true)
bool(true)

@@ -1135,7 +1135,7 @@ A\B::foo(); // calls method "foo" of class "B" from namespace "A\A"
<listitem>
<simpara>
<link linkend="language.namespaces.faq.builtinconst">Cannot override special
constants NULL, TRUE, FALSE, ZEND_THREAD_SAFE or ZEND_DEBUG_BUILD</link>
constants NULL, TRUE or FALSE</link>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should use the entities &null;, &false; and &true;

Also @Crell is or correct here or should it be and?

@haszi haszi requested a review from Girgias January 4, 2024 20:42
@Girgias Girgias merged commit a442778 into php:master Jan 5, 2024
2 checks passed
@haszi haszi deleted the Update-faq-on-overriding-special-constants branch January 5, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants