php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48833 Backslashes in comments
Submitted: 2009-07-07 12:37 UTC Modified: 2014-12-28 06:05 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: james at jamestandy dot com Assigned: sobak (profile)
Status: Closed Package: Website problem
PHP Version: Irrelevant OS: XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: james at jamestandy dot com
New email:
PHP Version: OS:

 

 [2009-07-07 12:37 UTC] james at jamestandy dot com
Description:
------------
Backslashes within user comments may not be getting inserted properly

Reproduce code:
---------------
http://uk3.php.net/manual/en/language.namespaces.basics.php

Looking at the first comment, I think backslashes are being stripped out of some text - this could get very confusing for users new to namespaces who read through the extra comments!

Expected result:
----------------
Im fairly sure the first comment should look like this

<?php
//  namespace MyProject\DB;
require 'db.php';

use MyProject\DB; // fine; same as DB\
use MyProject\DB\Connection as DBC; // fine
use MyProject\DB as HM; // fine
use HM\Connection as DBC2; // class call ends with FATAL!!!

$x = new DBC(); // fine
$y = new HM\Connection(); // fine
$z = new DBC2(); // Fatal error: Class 'HM\Connection' not found
?>

Actual result:
--------------
<?php
//  namespace MyProject\DB;
require 'db.php';

use MyProjectDB; // fine; same as DB\
use MyProjectDBConnection as DBC; // fine
use MyProjectDB as HM; // fine
use HMConnection as DBC2; // class call ends with FATAL!!!

$x = new DBC(); // fine
$y = new HMConnection(); // fine
$z = new DBC2(); // Fatal error: Class 'HM\Connection' not found
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-07 13:17 UTC] bjori@php.net
Hah. I never noticed this before as the mirrors I use run on PHP5.3.

This is due to the fact syntax highlighting is generated on the mirror itself, which may as well be running PHP4 which doesn't recognize this syntax...
 [2014-12-28 05:51 UTC] jacob dot bednarz at gmail dot com
This was last touched in 2009 and looks to be solved. Can this be closed?
 [2014-12-28 06:05 UTC] sobak@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: sobak
 [2014-12-28 06:05 UTC] sobak@php.net
Yes, it seems to be fixed long time ago. Thanks, Jacob!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 15:01:36 2025 UTC