Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZCiCalNode::addNode() incorrectly handles multiple nodes with same name #5

Open
pbiron opened this issue Mar 13, 2018 · 1 comment
Open

Comments

@pbiron
Copy link

pbiron commented Mar 13, 2018

Consider the following code:

$ical = new ZCiCal();
$vevent = new ZCiCalNode( 'VEVENT', $ical->curnode );
$vevent->addNode( new ZCiCalDataNode( 'RDATE:20180310' ) );
$vevent->addNode( new ZCiCalDataNode( 'RDATE:20180324' ) );
$ical-export();

The above results in output like:

BEGIN:VCALENDAR
PRODID:-//ZContent.net//ZapCalLib 1.0//EN
VERSION:2.0
BEGIN:VEVENT
RDATE:20180324
RDATE:20180324
END:VEVENT
END:VCALENDAR

which is incorrect: notice that both RDATE nodes in the output contain the value of last RDATE node added.

The correct output should be:

BEGIN:VCALENDAR
PRODID:-//ZContent.net//ZapCalLib 1.0//EN
VERSION:2.0
BEGIN:VEVENT
RDATE:20180310
RDATE:20180324
END:VEVENT
END:VCALENDAR

I've got a fix to ZCiCalNode::addNode() that results in the correct output for this particular case. I can submit a PR. However, since I'm really new to writing code to generate iCalendar feeds I'm not sure whether my fix will break other cases, and since you don't have any unit tests it's hard for me to tell.

Should I submit the PR anyway?

@cogliano
Copy link
Contributor

cogliano commented Mar 14, 2018 via email

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

No branches or pull requests

2 participants