#41976 [Fbk->Opn]: json_encode() ignores CDATA in SimpleXML data

2007-07-18 Thread stefan dot priebsch at e-novative dot de
 ID:   41976
 User updated by:  stefan dot priebsch at e-novative dot de
-Summary:  Please read before you mark bogus
 Reported By:  stefan dot priebsch at e-novative dot de
-Status:   Feedback
+Status:   Open
 Bug Type: JSON related
 Operating System: WinXP
 PHP Version:  5.2.3
 New Comment:

Ok, the problem: I have a SimpleXML object that I want to convert to
JSON using json_encode(). According to the manual, json_encode() works
on all types.

As soon as there is CDATA in the XML, that very node shows up as "" in
the JSON encoding. Remove the CDATA section, everything works. Thus I
claim that json_encode() does not work properly on CDATA, which I
consider a bug.


Previous Comments:


[2007-07-18 08:52:18] [EMAIL PROTECTED]

Don't use such texts for 'Summary'. Please write something that
describes the problem..

----

[2007-07-17 19:09:53] stefan dot priebsch at e-novative dot de

Johannes, would you please care to actually *read* and try to
*understand* my bug report before marking it as bogus?

My point is that json_encode() works properly with nested XML, but does
NOT work correctly when the nested XML contains CDATA.



[2007-07-17 12:36:14] [EMAIL PROTECTED]

$xml and (string)$xml are different things. Using different things as
arguments for a function gives different results.

----

[2007-07-17 10:46:38] stefan dot priebsch at e-novative dot de

I re-opened the bug due to the discussion of bug #42001. json_encode()
does not work on nested XML with a string cast, but it does work without
a string cast. (Of course except for the CDATA problem that made me file
this bug in the first place.)

$xml = new SimpleXMLElement('testvaluesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));

  $xml = new SimpleXMLElement('valuesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));



[2007-07-13 08:08:02] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Yes, and it will try to serialize the SimpleXML object, what won't
work, that's part of SimpleXML's behaviour 



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41976

-- 
Edit this bug report at http://bugs.php.net/?id=41976&edit=1


#41976 [Bgs->Opn]: Please read before you mark bogus

2007-07-17 Thread stefan dot priebsch at e-novative dot de
 ID:   41976
 User updated by:  stefan dot priebsch at e-novative dot de
-Summary:  Seems to work on nested XML, but not with CDATA
 Reported By:  stefan dot priebsch at e-novative dot de
-Status:   Bogus
+Status:   Open
 Bug Type: JSON related
 Operating System: WinXP
 PHP Version:  5.2.3
 New Comment:

Johannes, would you please care to actually *read* and try to
*understand* my bug report before marking it as bogus?

My point is that json_encode() works properly with nested XML, but does
NOT work correctly when the nested XML contains CDATA.


Previous Comments:


[2007-07-17 12:36:14] [EMAIL PROTECTED]

$xml and (string)$xml are different things. Using different things as
arguments for a function gives different results.



[2007-07-17 10:46:38] stefan dot priebsch at e-novative dot de

I re-opened the bug due to the discussion of bug #42001. json_encode()
does not work on nested XML with a string cast, but it does work without
a string cast. (Of course except for the CDATA problem that made me file
this bug in the first place.)

$xml = new SimpleXMLElement('testvaluesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));

  $xml = new SimpleXMLElement('valuesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));



[2007-07-13 08:08:02] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Yes, and it will try to serialize the SimpleXML object, what won't
work, that's part of SimpleXML's behaviour 

--------

[2007-07-13 06:33:16] stefan dot priebsch at e-novative dot de

Sorry, I disagree. This is a bug, not bogus.

The manual says that json_encode works on any type except resources. 

  $xml = new SimpleXMLElement('');
  var_dump(is_resource($xml));

outputs false, (which is obvious as SimpleXML is not listed in the list
of resource types). Thus SimpleXML is not a resource and must be
processed by json_encode() without a string cast. How would I supposed
to cast an XML tree to string anyway?

Please have a look at bug#38680, where a similar issue was discussed.



[2007-07-12 09:08:39] [EMAIL PROTECTED]

  var_dump((string) $xml);
  var_dump(json_encode($xml)); <-- you have to cast it to string
explicitly, otherwise json_encode() will encode the object itself, not
it's string representation.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41976

-- 
Edit this bug report at http://bugs.php.net/?id=41976&edit=1


#41976 [Bgs->Opn]: Seems to work on nested XML, but not with CDATA

2007-07-17 Thread stefan dot priebsch at e-novative dot de
 ID:   41976
 User updated by:  stefan dot priebsch at e-novative dot de
-Summary:  json_encode ignores CDATA sections
 Reported By:  stefan dot priebsch at e-novative dot de
-Status:   Bogus
+Status:   Open
 Bug Type: JSON related
 Operating System: WinXP
 PHP Version:  5.2.3
 New Comment:

I re-opened the bug due to the discussion of bug #42001. json_encode()
does not work on nested XML with a string cast, but it does work without
a string cast. (Of course except for the CDATA problem that made me file
this bug in the first place.)

$xml = new SimpleXMLElement('testvaluesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));

  $xml = new SimpleXMLElement('valuesomething');
  var_dump(json_encode($xml));
  var_dump(json_encode((string) $xml));


Previous Comments:


[2007-07-13 08:08:02] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Yes, and it will try to serialize the SimpleXML object, what won't
work, that's part of SimpleXML's behaviour 

--------

[2007-07-13 06:33:16] stefan dot priebsch at e-novative dot de

Sorry, I disagree. This is a bug, not bogus.

The manual says that json_encode works on any type except resources. 

  $xml = new SimpleXMLElement('');
  var_dump(is_resource($xml));

outputs false, (which is obvious as SimpleXML is not listed in the list
of resource types). Thus SimpleXML is not a resource and must be
processed by json_encode() without a string cast. How would I supposed
to cast an XML tree to string anyway?

Please have a look at bug#38680, where a similar issue was discussed.



[2007-07-12 09:08:39] [EMAIL PROTECTED]

  var_dump((string) $xml);
  var_dump(json_encode($xml)); <-- you have to cast it to string
explicitly, otherwise json_encode() will encode the object itself, not
it's string representation.

----------------

[2007-07-12 07:39:30] stefan dot priebsch at e-novative dot de

Description:

When json_encoding (Simple)XML data, CDATA sections are ignored.

Reproduce code:
---
  $xml = new SimpleXMLElement('test');
  var_dump((string) $xml);
  var_dump(json_encode($xml));

  $xml = new SimpleXMLElement('');
  var_dump((string) $xml);
  var_dump(json_encode($xml));


Expected result:

string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{"0":"test"}' (length=12)


Actual result:
--
string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{}' (length=2)






-- 
Edit this bug report at http://bugs.php.net/?id=41976&edit=1


#41976 [Bgs->Opn]: json_encode ignores CDATA sections

2007-07-12 Thread stefan dot priebsch at e-novative dot de
 ID:   41976
 User updated by:  stefan dot priebsch at e-novative dot de
 Reported By:  stefan dot priebsch at e-novative dot de
-Status:   Bogus
+Status:   Open
 Bug Type: JSON related
 Operating System: WinXP
 PHP Version:  5.2.3
 New Comment:

Sorry, I disagree. This is a bug, not bogus.

The manual says that json_encode works on any type except resources. 

  $xml = new SimpleXMLElement('');
  var_dump(is_resource($xml));

outputs false, (which is obvious as SimpleXML is not listed in the list
of resource types). Thus SimpleXML is not a resource and must be
processed by json_encode() without a string cast. How would I supposed
to cast an XML tree to string anyway?

Please have a look at bug#38680, where a similar issue was discussed.


Previous Comments:


[2007-07-12 09:08:39] [EMAIL PROTECTED]

  var_dump((string) $xml);
  var_dump(json_encode($xml)); <-- you have to cast it to string
explicitly, otherwise json_encode() will encode the object itself, not
it's string representation.



[2007-07-12 07:39:30] stefan dot priebsch at e-novative dot de

Description:

When json_encoding (Simple)XML data, CDATA sections are ignored.

Reproduce code:
---
  $xml = new SimpleXMLElement('test');
  var_dump((string) $xml);
  var_dump(json_encode($xml));

  $xml = new SimpleXMLElement('');
  var_dump((string) $xml);
  var_dump(json_encode($xml));


Expected result:

string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{"0":"test"}' (length=12)


Actual result:
--
string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{}' (length=2)






-- 
Edit this bug report at http://bugs.php.net/?id=41976&edit=1


#41976 [NEW]: json_encode ignores CDATA sections

2007-07-12 Thread stefan dot priebsch at e-novative dot de
From: stefan dot priebsch at e-novative dot de
Operating system: WinXP
PHP version:  5.2.3
PHP Bug Type: JSON related
Bug description:  json_encode ignores CDATA sections

Description:

When json_encoding (Simple)XML data, CDATA sections are ignored.

Reproduce code:
---
  $xml = new SimpleXMLElement('test');
  var_dump((string) $xml);
  var_dump(json_encode($xml));

  $xml = new SimpleXMLElement('');
  var_dump((string) $xml);
  var_dump(json_encode($xml));


Expected result:

string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{"0":"test"}' (length=12)


Actual result:
--
string 'test' (length=4)

string '{"0":"test"}' (length=12)

string 'test' (length=4)

string '{}' (length=2)


-- 
Edit bug report at http://bugs.php.net/?id=41976&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41976&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41976&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41976&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41976&r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=41976&r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=41976&r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=41976&r=needscript
Try newer version:http://bugs.php.net/fix.php?id=41976&r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=41976&r=support
Expected behavior:http://bugs.php.net/fix.php?id=41976&r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=41976&r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=41976&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41976&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41976&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41976&r=dst
IIS Stability:http://bugs.php.net/fix.php?id=41976&r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=41976&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41976&r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=41976&r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=41976&r=mysqlcfg


#24671 [NEW]: Case problem with internal list of included files handling

2003-07-16 Thread stefan dot priebsch at e-novative dot de
From: stefan dot priebsch at e-novative dot de
Operating system: Win2K, WinXP
PHP version:  4.3.2
PHP Bug Type: Scripting Engine problem
Bug description:  Case problem with internal list of included files handling

Description:

When the same file is include_once'd multiple times, but with a different
case, PHP does not recognize that actually the same file is included
multiple times. This can lead to "cannot redefine function (resp. class)"
errors.

>From looking at the array returned by get_included_files, it seems that
PHP handles the list in a case-sensitive way, which obviously is wrong
since Win path and file names are not case sensitive.

To reproduce the error, create main.php and include.php using the code
below. The example produces a "cannot redefine" error, which is unexpected
behaviour.

When commenting out the function definition and running the example again,
one can see that the included file name appears twice in the list, but
with different case.

Reproduce code:
---
main.php:

  print 'main ';
  
  include_once ('include.php');
  print_r (get_included_files ());
  
  include_once ('Include.php');
  print_r (get_included_files ());

include.php:

  print 'included file ';

  function included_fn ()
  {
print 'included fn ';
  } 


Expected result:

main included file Array ( [0] => main.php [1] => include.php ) included
file 

[full paths removed for clarity]

Actual result:
--
main included file Array ( [0] => main.php [1] => include.php ) included
file 
Fatal error: Cannot redeclare included_fn() (previously declared in
include.php:7) in Include.php on line 5

[full paths removed for clarity]

-- 
Edit bug report at http://bugs.php.net/?id=24671&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24671&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24671&r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=24671&r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=24671&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24671&r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=24671&r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=24671&r=support
Expected behavior:  http://bugs.php.net/fix.php?id=24671&r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=24671&r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=24671&r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=24671&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24671&r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=24671&r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=24671&r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=24671&r=gnused