Skip to content

Conversation

@vhuk
Copy link
Contributor

@vhuk vhuk commented Aug 21, 2018

Set undefined values to null rather than undefined.

Fixes bug #76777.

Set undefined values to null rather than undefined.
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

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

Thanks! The patch looks good to me, but there appear to be some issues in the PHPT.

--TEST--
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
--SKIPIF--
<?php if (!extension_loaded('libxml')) die('skip'); ?>
Copy link
Member

Choose a reason for hiding this comment

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

The test should also be skipped if --offline is given, i.e. something like if (getenv("SKIP_ONLINE_TESTS")) die('skip online test'); would be reasonable.

<?php if (!extension_loaded('libxml')) die('skip'); ?>
--FILE--
<?php
ini_set('error_reporting',PHP_INT_MAX-1);
Copy link
Member

Choose a reason for hiding this comment

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

Usually, we do not set error_reporting unless there's a particular reason to do so, which doesn't seem to be the case here (also PHP_INT_MAX-1 is quite uncommon to my knowledge).


libxml_set_external_entity_loader(function($p,$s,$c) {
var_dump($p,$s,$c);
die();
Copy link
Member

Choose a reason for hiding this comment

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

To die here seems doubtful. I'd rather remove the var_dump 4 lines below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

die is there to avoid schema parsing errors on output as they are not relevant to the test, but are artifact of simplistic test case:

Warning: DOMDocument::schemaValidateSource(): Element '{http://www.w3.org/2001/XMLSchema}include': Failed to parse the XML resource 'nonexistent.xsd'. in /in/Tt5TM on line 20

Warning: DOMDocument::schemaValidateSource(): Invalid Schema in /in/Tt5TM on line 20

Copy link
Member

Choose a reason for hiding this comment

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

Ah, okay. Thanks!

libxml_set_external_entity_loader(function($p,$s,$c) {
var_dump($p,$s,$c);
die();
});
Copy link
Member

Choose a reason for hiding this comment

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

Indentation error?

@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Thanks. Applied via cf2fc66.

@php-pulls php-pulls closed this Aug 22, 2018
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.

3 participants