[2.0b4] pg_escape_string() expects exactly 1 parameter, 2 given

Started by Kakao, September 28, 2008, 11:37:47 AM

Previous topic - Next topic

Kakao

Centos 5.1 postgresql 8.3.4

When trying to access example.com/index.php

PHP Warning:  pg_escape_string() expects exactly 1 parameter, 2 given in
/var/www/html/example.com/Sources/Subs-Db-postgresql.php on line 135


Kakao

After many lines like the above error message it dies like this:

PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried to allocate 84 bytes)
in /var/www/html/example.com/Sources/Errors.php on line 95,
referer: http://example.com/install.php?step=5

Chonunca

it's a php bug reported in Aug 2007 :
hxxp:bugs.php.net/bug.php?id=42368 [nonactive]

I think should be probably fixed in last php version (i'd encounter this bug with the 5.1.3RC4-dev php version, it's the version installed on my host, i can't choose it)

Oldiesmann

It's not a bug with PHP. In this case the error is correct.

The problem is that the connection parameter wasn't added until PHP 5.2.0...

Find
return sprintf('\'%1$s\'', pg_escape_string($connection, $replacement));

Replace
return sprintf('\'%1$s\'', pg_escape_string($replacement));

Bug #2675: pg_escape_string only accepts one paramter in PHP < 5.2.0

Advertisement: