PHP SimpleXML is broken: Part 1

Jan 02, 2016 18:24


The following code does not work as expected:

$xml = simplexml_load_string("text"); $node = $xml->xpath("/root/a")[0]; if ($node) process($node); // process($node) may not be called for some valid nodes

Unlike most other objects, SimpleXmlElement may evaluate as false even when it is not null. Specifically, SimpleXmlElements representing empty ( Read more... )

hacker's diary, software development, web development

Leave a comment

Why PHP? dennisgorelik January 3 2016, 00:47:43 UTC
> You should never have ventured in that cruel PHP land.

So why do you program in PHP now?

Reply

Re: Why PHP? yatur January 3 2016, 00:52:06 UTC
I use PHP for small projects on my web site because

- It integrates well with Apache, which is my web server
- It is used by my blog engine, WordPress
- It's free
- It's a different language that gives you a different perspective
- I did not have serious issues with it before

Reply

Re: Why PHP? dennisgorelik January 3 2016, 01:00:59 UTC
> - It integrates well with Apache, which is my web server

Why do you use Apache as your web server?
Why not keep using IIS?

> - It is used by my blog engine, WordPress

That's a good reason.
But why program your blog?
You can just use it as is, right?

> - It's free

Not really.
Your research & development time is at least an order of magnitude more valuable than hosting price.

> - It's a different language that gives you a different perspective

That's a very important reason, I agree.

> - I did not have serious issues with it before

So what do you plan to do about it after you discovered serious issues?

Reply

Re: Why PHP? yatur January 3 2016, 01:08:58 UTC
> Why do you use Apache as your web server?
> Why not keep using IIS?

Because I run my web server at home, and for IIS to work right and not give stupid errors on too many connections, I would have to buy a retail Windows Server.

> more valuable than hosting price.

A what price? I don't host it :) I play with it at home on a machine that I got sort of for free long time ago. I do crazy stuff with it I would never be able to do on a shared hosting, and dedicated hosting is too expensive. Research and development time is part of fun.

> So what do you plan to do about it after you discovered serious issues?

I don't know yet.

Reply

Re: Why PHP? dennisgorelik January 3 2016, 01:30:47 UTC
> and dedicated hosting is too expensive

You can use VPS.
Quick googling shows $13/mo.

It would save you some electricity + would save your administration time.

> Research and development time is part of fun.

You can focus your research in different direction, e.g. developing functionality that is actually useful to your [potential] users.

Reply

Re: Why PHP? yatur January 3 2016, 03:21:56 UTC
> It would save you some electricity

Maybe.

> would save your administration time.

Hardly. That server is extremely stable (and it's Windows Vista, BTW :). Trivial administration I do effortlessly, and non-trivial administration would take approximately the same time.

In any case, transition to the new environment would be painful, especially if you are talking about revolutionary changes like switching from Apache to IIS, moving away from PHP, etc.

> You can focus your research in different direction, e.g. developing functionality that is actually useful to your [potential] users.

I might, or I can do what I do. This is a hobby after all, I have enough IIS at work. Throwing away Apache is not a viable option. Using something besides PHP definitely is.

What would you recommend? Node.JS? Ruby no rails?

Reply

Re: Why PHP? dennisgorelik January 3 2016, 05:15:54 UTC
> What would you recommend? Node.JS? Ruby no rails?

I have no practical experience with these technologies and only very limited theoretical knowledge.

About Node.js I know that it is compilable server technology with Javascript language.

About "Ruby no rails" I know that you misspelled it.
I also know that "Ruby no rails" is somewhat similar to C#, but is relatively slow.

I can help you in your new tech quests by asking challenging questions, but generally my tech expertise would be lagging behind what you already found out.

Reply

Re: Why PHP? rrr2 January 3 2016, 06:53:01 UTC
python? Works well under Apache

Reply


Leave a comment

Up