http://www.osoft.com/store/products/osoft_1490922690php-logo.png

I’m a programmer and I’ve written a few compilers, but maybe my expectations are too high? Here is some PHP code that doesn’t work. But if you report it as a bug as I did they say, “that’s how it’s supposed to work”. I think they think if you document a bug it’s not a bug any more. This is what gives open source a bad name… lack of responsibility.

Here’s the code. Pretty simple stuff

$myarray = array("one","two","three","four");

foreach ($myarray as &$x) {
   $x = "$x -";
   print "$x\n";
}

print "\n";

foreach ($myarray as $x) {
   print "$x\n";
}

You would expect it to print this:

one -
two -
three -
four -
one -
two -
three -
four -

Actual result:

one -
two -
three -
four -

one -
two -
three -
three -

As you can see – not what a reasonable person would expect. Not only am I shocked that PHP fails this simple example, but when I went to report it the response is “that’s not a bug – it’s supposed to do that”. It supports my claim that the VI editor causes brain damage.




  1. Travis says:

    I guess you never worked with Oracle or Cisco. They sell insanely expensive support contracts that come with special phone numbers to call 24/7 and weekly review meetings where an engineer will tell you that the product is working as designed or that this bug will be fixed in the next release. The simple truth is that bugs happen, and you have to deal with them.

  2. cgp says:

    I would not call that a bug unless the non use of the ‘&’ in the parameter is not the correct calling usage.

    I would call it a flaw that should not have been allowed. This side effect seems to be something simple, and if it is a result of something complex then php implementation is way over complex for such simple actions.

    Or as the author points out it is lack of professional quality control (in a big way).

    This is not half of my objection to open source. I believe it to be a scam to get something for nothing. So much time and blood and sweat is expended for code creation that the call for freely giving it away under the pretension that it is the current business practice further convinces me that software engineering today is a mugs game. E.g., 100,000 iphone coders ridiculous, all that creativity put to waste in the rotten Apple app queue.

  3. Hmeyers says:

    @ Pedro

    “Open source sucks. I’m still mad at Opera for all the bugs”

    Pedro, you barnacle head — Opera is NOT open source.

  4. 2akeens says:

    @#32

    If OSS is a scam, it seems to work pretty well. We’re running a business on the LAMP stack here, thank you very much.

    And sorry to break it to you, but the App Store is CLOSED SOURCE. You have to pay to run your own software on the iPhone. Bad example there, bad example.

  5. Hmeyers says:

    @32 cgp

    “This is not half of my objection to open source. I believe it to be a scam to get something for nothing.”

    Open source is the idea that human creativity builds atop others works. Medical advancements are shared in the scientific field. Advancements in engineering, aeronautics are shared. Einstein certainly shared his mathematical theories. The concept of open source is to at least prevent closed source from monopolizing a particular industry and to advance the general good. Closed source still has purpose, but to give it exclusivity is to anoint false gods to rule over you.

  6. interglacialman says:

    From the comments in the report it sounds like the php software is working as designed but not as you expect.

    The easiest way to deal with these kind of issues is to be flexible and change the initial assumptions of how you planned to do the implementation. Even if the problem you have is a bug, or you are convinced your way is the correct one, you’re usually better off just ‘working around’ any software quirk or unexpected limitation.

    I’d count yourself lucky you didn’t have to spend countless hours on the phone to India to arrive at this position. In my experience this kind of problem is even worse with commercial software.

  7. bac says:

    This issue is in the documentation, at least the online version. Plus, there is feed back about how to deal with the behavior.

    It seems to me the Marc is trying to use a development tool without understanding the behaviors of such tool. If he had read the documentation, he would have known about this quirk and avoided using the tool in the way that brings about this quirk.

    If you know the hammer breaks glass and you don’t want to break glass then don’t use the hammer on glass.

  8. ECA says:

    iM SORRY GUYS..
    If you want stuff to work you will have to go back BEFORE visual basic and Visual C..
    GET OFF the new fangled OS’s and back to basic.

  9. jbellies says:

    #33 #35. Pedro and most of those commenting here know that Opera is closed source. I rank his remark as sardonic. Here’s another one: “Perkel isn’t using the right tool for the job. For fancy footwork string output, use Icon rather than PHP.”

    Incidentally, I use Opera 10 (which I call OperaX) and it “works fine for me”.

  10. 1894 says:

    Hey #6, I went to that link you provided and I nearly fainted. I could read the page so easily, see the links perfectly, and it made me wonder why the whole internet isn’t done in the fancy PHP stuff.

    I guess my shock is a bit exaggerated but the point is I’m so sick of going to websites in poofy light blue and light grey and light green and light pink, so light I can’t even see it if I put on a reading light.

    I mean, who are these IDIOTS that make pages like that. I mean, it’s not 1984.

  11. qb says:

    #14 You’re using a Type 1 JDBC driver to hit a MS Access database? What’s next, Spock with a beard?

  12. jccalhoun says:

    I’m no programmer so I may be totally wrong here. However, given the comments here especially number 20, this seems to be starting to smell like another “forever stamp” post http://dvorak.org/blog/2009/02/01/forever-stamp-not-forever-at-san-francisco-post-office/ where Marc Perkel is proven to be wrong and refuses to admit it.

  13. amodedoma says:

    Go ahead try an Ubuntu installation, give open source a chance. I’m sure once you’ve used some decent software that doesn’t require buying or pirating anything, you’ll be hooked. Oh and if you think you’ll get better technical assistance just because your paying, better think again. In fact I’ve used developer software from maybe a dozen sources and I usually find the help I need on the net in the blogs etc. Who has time to wait on hold for some guy with a funny accent from some far away nation to help you? – If you know how to use a search engine – it’s better and faster than customer support and technical assistance combined. Right now I’m using chromium browser (google’s opensource) and it’s amazingly efficient on system resources. If it’s any indication I’d say Chrome OS is gonna be a big hit.

  14. hhh says:

    Marc,

    please admit you’re wrong.

    this way we can stop talking about it already.

  15. Mike Yuen says:

    All languages have this kind of odd ‘feature’… its not really an open source specific situation. Most of what you spend time doing as a programmer is learning about these things. Then learning that all the computer and language are doing is what you told them to….

    A case of “do what i want you to do not what i told you to do”.

  16. kelphis says:

    I would hope that adding a print_r() in the second loop will show why this is not a bug. You can actually see that $x is still a referenced variable and that the array is being modified as the loop is iterated. So upon each iteration $x is being assigned the next element in $myarray.

    2 things to avoid this behavior is to unset($x) after the first loop or use a different variable in the second loop. Each one will work, but I think that the first option would work best considering you seem to expect this behavior to happen anyways. You are basically complaining the php doesn’t know what you are trying to do with a variable that you are using in to different places within the same scope.

  17. PhP Programmer says:

    PHP is a tool that allows your website to have functionalities for business purposes. If you want to improve and upgrade, you can always get the services of a PHP programmer.


0

Bad Behavior has blocked 5684 access attempts in the last 7 days.