php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40416 Note posting
Submitted: 2007-02-09 16:07 UTC Modified: 2007-02-11 17:31 UTC
From: danielcottrell at operamail dot com Assigned:
Status: Not a bug Package: Website problem
PHP Version: Irrelevant OS: xp pro
Private report: No CVE-ID: None
 [2007-02-09 16:07 UTC] danielcottrell at operamail dot com
Description:
------------
When previewing notes that you add to the docummentation they don't recognise new lines/paragraphs.

Reproduce code:
---------------
Just to confirm, USING UNSET CAN DESTROY AN ENTIRE ARRAY. I couldn't find reference to this anywhere so I decided to write this. 

The difference between using unset and using $myarray=array(); to unset is that obviously the array will just be overwritten and will still exist.

<?php

$myarray=array("Hello","World");

echo $myarray[0].$myarray[1];

unset($myarray);
//$myarray=array();

echo $myarray[0].$myarray[1];

echo $myarray;
?>

Output with unset is:
<?
HelloWorld

Notice: Undefined offset: 0 in C:\webpages\dainsider\myarray.php on line 10

Notice: Undefined offset: 1 in C:\webpages\dainsider\myarray.php on line 10


Output with $myarray=array(); is:
?>

<?
HelloWorld

Notice: Undefined offset: 0 in C:\webpages\dainsider\myarray.php on line 10

Notice: Undefined offset: 1 in C:\webpages\dainsider\myarray.php on line 10

Array
?>

Expected result:
----------------
Proper newlines and paragraphs, essentially a more accurate preview.

Actual result:
--------------
Just to confirm, USING UNSET CAN DESTROY AN ENTIRE ARRAY. I couldn't find reference to this anywhere so I decided to write this. The difference between using unset and using $myarray=array(); to unset is that obviously the array will just be overwritten and will still exist. <?php $myarray=array("Hello","World"); echo $myarray[0].$myarray[1]; unset($myarray); //$myarray=array(); echo $myarray[0].$myarray[1]; echo $myarray; ?> Output with unset is: <? HelloWorld Notice: Undefined offset: 0 in C:\webpages\dainsider\myarray.php on line 10 Notice: Undefined offset: 1 in C:\webpages\dainsider\myarray.php on line 10 Output with $myarray=array(); is: ?> <? HelloWorld Notice: Undefined offset: 0 in C:\webpages\dainsider\myarray.php on line 10 Notice: Undefined offset: 1 in C:\webpages\dainsider\myarray.php on line 10 Array ?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-10 14:08 UTC] bjori@php.net
Can't reproduce.

Which mirror did you use?
 [2007-02-10 23:54 UTC] danielcottrell at operamail dot com
The mirror was us2.php.net. Try using the info posted as part of my original bug submission.
 [2007-02-11 17:31 UTC] bjori@php.net
This is a bug in PHP4.4.0 which is caused by the syntax 
error in your example.

There is no known workaround in user-space so we can't fix 
it => marking bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 17:01:33 2024 UTC