# Code executes differently on Photon than on Core

**URL:** <https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243>\
**Category:** Troubleshooting\
**Created:** [June 1, 2015, 5:11pm UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243 "2015-06-01T17:11:25Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [August 23, 2015, 4:04am UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/21 "2015-08-23T04:04:37Z")

</div>

Hi @codiak

I tried to reformat your code and output sections, but I don’t get why you have all the \*'s in the code. It makes it really hard to read since \* is an operator in C. Maybe a better cut-and-paste would help us figure out what is going on.

The problem of concatenating String objects is fixed on Photon but not on Core yet.

---

<div class="post-metadata">

**Author:** ![codiak](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@codiak](https://community.particle.io/u/codiak)\
**Post date:** [August 23, 2015, 4:23am UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/22 "2015-08-23T04:23:37Z")

</div>

@bko This code was built with 0.4.4 and tested on the photon.

Ignore he splats,ignore them if you want… It was a quick hack to print the timeStr character for character.

Bottom line bug statement is

If you start a string with the results for timeStr eveu after is truncatred.  
If you put timeStr as the last concat it works  
Again this is on the photon, 0.4.4 local…

Ive got a work around in my real code. What i provided is just to demo the issue

---

<div class="post-metadata">

**Author:** ![BobG](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@BobG](https://community.particle.io/u/BobG)\
**Post date:** [August 23, 2015, 4:49am UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/23 "2015-08-23T04:49:28Z")

</div>

I can verify that the bug is still present in 0.4.4-rc3. Just to clarify – the string concatenation works fine when compiling for Core (always has); this has always been a Photon only issue and an issue specifically when trying to concatenate a substring onto the end of the string returned by Time.timeStr().

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [August 23, 2015, 5:55am UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/24 "2015-08-23T05:55:02Z")

</div>

I think this might be related to the fact that we remove the trailing newline in the 0.4.x series of firmware? I’ll add a unit test to be sure.

---

<div class="post-metadata">

**Author:** ![mdma](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mdma/32/1924_2.png) [@mdma](https://community.particle.io/u/mdma)\
**Post date:** [August 23, 2015, 6:54am UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/25 "2015-08-23T06:54:42Z")

</div>

Update: Sorry about this, but I’m pleased to say it’s now fixed. it was due to the way we were removing the unwanted newline in the asctime() function that timeStr() uses.

> <https://github.com/particle-iot/firmware/issues/577>

This is fixed in the PR linked to the issue. This will be merged into the develop branch soon and released to the compile server with the 0.4.5 release, planned Wednesday next week.

---

<div class="post-metadata">

**Author:** ![Rockvole](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rockvole/32/20733_2.png) [@Rockvole](https://community.particle.io/u/Rockvole)\
**Post date:** [September 3, 2015, 3:30pm UTC](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243/26 "2015-09-03T15:30:40Z")

</div>

Is the 0.4.5 release available outside of dev ?

[Previous page](https://community.particle.io/t/code-executes-differently-on-photon-than-on-core/12243.md?page=1)
