Doc #80497 [NEW]: Incorrect example on OOP The Basics page

From: Date: Wed, 09 Dec 2020 06:04:01 +0000
Subject: Doc #80497 [NEW]: Incorrect example on OOP The Basics page
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18218@lists.php.net to get a copy of this message
From:             iamvar at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Incorrect example on OOP The Basics page

Description:
------------
On the https://www.php.net/manual/en/language.oop5.basic.php
There is a typo
It said that
print Some\Class\DoesNot\Exist::class;

will print Some\Class\Does\Not\Exist

But it will not, there are 2 problems:
Word Class in the namespace, missing slash for print statement
DoesNot\Exist instead of Does\Not\Exist 

Test script:
---------------
print Some\Class\DoesNot\Exist::class;

Expected result:
----------------
print Does\Not\Exist::class;

will print Does\Not\Exist

Actual result:
--------------
Parse error:  syntax error, unexpected 'Class' (T_CLASS), expecting
identifier (T_STRING) in php shell code on line 1

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80497&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80497&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80497&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80497&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80497&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80497&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80497&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80497&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80497&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80497&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80497&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80497&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80497&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80497&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80497&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80497&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80497&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80497&r=mysqlcfg


Thread (3 messages)

« previous php.doc.bugs (#18218) next »