phpurple compile error - php 5.3 - php

Im trying to compile phpurple. Im doing everything according to the documentation:
hxxp://phurple.php.belsky.info/ch02.html
but "make" gives me an error:
/myhomedir/phpurple/purple.c: In function ‘call_custom_method’:
/myhomedir/phpurple/purple.c:1370: error: ‘zend_fcall_info’ has no member named ‘object_pp’
/myhomedir/phpurple/purple.c:1408: error: ‘zend_fcall_info_cache’ has no member named ‘object_pp’
I`ve found other people with the same problem:
hxxp://www.mail-archive.com/monetdb-bugs#lists.sourceforge.net/msg05515.html
hxxp://belsky.info/archives/23-Phurple-per-se-PHPurple.html
but nobody gives any information about successful php 5.3 build and the message
PROJECT IS CLOSED if you want
commercial support for php 5.3, let me
know ... )
does not help at all.
does anyone have any idea how to compile it or any clue how to fix the problem ?
P.S. Sorry about the links, some strange StackOverflow limitation

According to phpurple requirements:
Please let me know, if you've successfully compiled on
earlier versions. Actually the extension is being developed
on the php v5.2.6 with the option to be upcomming php v5.3
compatible.
The authors will need to update their source. However, since you have the source you could update it yourself because you noted that the project is CLOSED. You could also fork the code and create your own gitHub project with php 5.3 support.
Good luck.

What you are seeing is PHP's shifty interface (ahem, hold your down votes, I said s h i f t y). By that, I mean function prototypes are subject to change from version to version. Take this meta example:
int foo_call_bar(const char *foobar, size_t len);
And in a later version of something, the function calculates the length dynamically, thus eliminating the second variable in the prototype:
int foo_call_bar(const char *foobar);
Some projects strive to always maintain backwards compatibility to alleviate this headache, which could be accomplished with pre-processor directives that prototype the new implementation with the len variable, but just don't do anything with it. If PHP did that, the code base would succumb to even more madness.
Unfortunately, you'll have to modify phpurple to present the correct arguments to the correct PHP functions, and ensure that they are of the appropriate type. That would be a bit of an undertaking, but probably wouldn't be as difficult as it seems.
The Linux kernel's VFS interface is the same way, and I'm often tasked with porting older experimental file systems to work on modern kernels.

look at that man
http://sourceforge.net/news/?group_id=235197&id=296063

A little late, but here is the latest library that works with PHP 5.3:
The new project page is: http://sourceforge.net/projects/phurple
The blog post: http://belski.net/archives/23-Phurple-per-se-PHPurple.html
I have ran into a problem after I have complied it and added the extension to PHP.ini configuration:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phurple.so' - /usr/lib/php/modules/phurple.so: undefined symbol: ZVAL_ADDREF in Unknown on line 0
To fix this, change the line containing ZVAL_ADDREF in client.c from
ZVAL_ADDREF(PHURPLE_G(phurple_client_obj));
to
Z_ADDREF_P(PHURPLE_G(phurple_client_obj));

Well, the new URL seems to be a persistent repo with fixes to PHP-5.3 and above. Maybe that should be mentioned, but that won't help with checking it out anyway. For me it worked fine, so I would say it is worth a try.

You can check the new sources shortly posted on https://github.com/weltling/phurple

Related

MongoDB/DocumentDB bson_append_array(): invalid array detected. first element of array parameter is not "0"

Recently I have migrated one of my projects (PHP 7.4/Lumen/Ubuntu 20.04) from MongoDB to MongoDB compatible AWS DocumentDB. Since the migration all the CLI Scripts are triggering this strange notice/warning
bson_append_array(): invalid array detected. first element of array parameter is not "0".
Everything seems to be functionally working apart from this message (Even though I have all the PHP errors hidden from ini file this still shows up). Not really sure what is going on.
Message is actually coming from "find" method. I also did try to suppress the msg but no luck.
Does anyone have any idea what is going on here ? Appreciate and thanks for all your responses in advance.
DocumentDB version 4.0
PHP SDK Composer version 1.9.0
If you add &authMechanism=SCRAM-SHA-1 to the connexion string, the warning disepear.
I am answering my own questions based on my findings so far.
Seems like there is no solution for this issue since AWS DocumentDB is not 100% compatible with MongoDB (As per mongoDb documentation over 66% of all of the correctness tests have failed for DocumentDB). Also it is extremely difficult get AWS support for these sort of incompatibility issues, they always refer you to public user forum.
MongoDB recently put up a blog post summering incompatibility issues with DocumentDB and it makes a lot of sense. You can read it in detail here - https://www.mongodb.com/atlas-vs-amazon-documentdb/compatibility
My recommendation is if you are considering using documentDB as a replacement of Mongo do not bother. Save your precious time by sticking with MongoDB.

Does PHP have a built-in means of determining the oldest PHP version compatible with a given PHP script? Or will it ever?

I wish to be able to do something like:
php --determine-oldest-supported-php-version test.php
And get this output:
7.2
That is, the php binary checks test.php for all function calls or syntax used, and then spits out the oldest version of PHP which would be able to run the script.
The purpose would be for me to create a script which goes through all the .php files in my library/framework and figures out which version of PHP I should consider to be the "oldest supported version".
Currently, I'm doing this manually. Whenever I knowingly use a new feature, function or syntax, I bump up a variable to "7.4" or whatever, and then compare the currently used PHP version against that on runtime. This is not ideal, as you can imagine, and I could very well forget to bump up this value or bump it up too much, or too little, etc.
It would be much nicer to be able to determine this automatically, with such a feature in PHP itself.
I have of course looked through the list of options and PHP has no such feature as far as I can tell. Since I basically answered my own question right away, are there any plans on such a feature in the future?
The only guarantee given is that PHP will remain compatible within the same major version.
You may be interested in looking at the article
Why You Should Be Using Supported PHP Versions.
The tool you are looking for is the GitHub project
PHP_CodeSniffer,
further described in the article
PHPCompatibility update.
You may run it using a command such as:
phpcs --standard=PHPCompatibility --runtime-set testVersion 5.4 <path-of-your-php-files>

Using second argument of php assert function throws compile time exception via HHVM

By PHP 5.4.8, assert function has a second argument as description.
I wonder why HHVM throws exception when filling the second argument!
It says: Too many arguments for assert(), expected 1
Is there any configuration I miss?
The latest version of HHVM should, in theory, support pretty much every feature present in PHP 5.5. This includes that second argument for the assert function. I can't find a link to support this statement at the moment, but I will edit and add it if I find it later.
Make sure you're running the latest version of HHVM (3.2 at the time when I'm writing this). If you are and you still have this error, search for this issue on HHVM's GitHub page and, if none is there that fits this problem, create one. Since HHVM is open-source, you can even fix it yourself, it would be a great exercise :) .

PHP strange error messages

I have created a website 3 month ago. I uploaded it to internet and it worked(it still works there). Now I installed it in my local computer and trying to access it. However it prints the following error messages multiple times:
Deprecated: Assigning the return value of new by reference is
deprecated in C:\xampp\htdocs\ptr\xajax\xajax_core\xajax.inc.php on
line 1258
Strict Standards: Only variables should be assigned by reference in
C:\xampp\htdocs\ptr\xajax\xajax_core\xajaxPluginManager.inc.php on
line 269
I am using XAJAX framework and the errors have something to do with this framework. Since I haven't changed anything in the library files, I don't understand what the problem can be. Please help... I am freaking out
The framework you are using seems to be a little bit outdated and uses such constructs
$x = & new Classname();
The & before new is deprecated since PHP 5.0 (which is several years old now). With the introduction of E_DEPRECATED- and E_STRICT-messages it throws such a message now.
Unfortunately this kind of statement are deprecated from PHP 5. In your local machine you're running a version which is 5.3 while your server is running an older version. Thus, on your machine is thrown a E_STRICT error. To avoid this problem, you have to change lines like:
$node_obj =& new someClass($somearg, $moreargs);
into
$node_obj = new someClass($somearg, $moreargs);
Xajax 0.6 targets this and a couple of other issues. When the development on xajax 0.5 started many users were still trapped on PHP4 Webservers and this syntax helped maintain compatibility for PHP4 up to 5.2.x.
Xajax 0.6 can be found on https://github.com/Xajax/Xajax-Project
Though it's still beta, it's already pretty solid. Many deprecated function were dropped and the core was shrinked & optimized.
Previous comments fully explain the source of those warnings. Your website will work fine despite of them. But you can disable PHP error reporting, if you want to hide these messages - this manual may help you: http://complete-concrete-concise.com/web-tools/how-to-turn-off-display_errors-in-xampp
(UPD: For your local version only of course)

Fatal error: Call to undefined function domxml_new_doc()

When i want to use xml libraries in php i get this error
Fatal error: Call to undefined function domxml_new_doc() in C:\AppServ\www\direction\db2xml.php on line 5
how can i solve it ?
The domxml_new_doc() function is from the PHP4 DOM extension. It has been moved to the PECL repository and is no longer bundled with PHP as of PHP 5.0.0. PHP5 introduced a number of improved extensions to work with XML:
It will, however, never be released with PHP 5, and will only be distributed with PHP 4. If you need DOM XML support with PHP 5 you can use the DOM extension. This domxml extension is not compatible with the DOM extension.
See my answers to
Best XML Parser for PHP
PHP what is the best approach to using XML? Need to create and parse XML responses
If you are working with older code from PHP4 and wish to migrate the code to work on a php5 server with minimal effort, check out the following:
http://www.silicon-vision.com/wp/quickpost-php4-domxml-to-php5/
Simply drop in the include file and reference it at the start of the file that is failing, and it will simply just work like it used to. Not much else to it really. Used it on several older sites after migrating them to a new VPS earlier this year and was quite pleased at solving the issue without having to sit there and rewrite someones spaghetti code :)
Update 2015: I no longer maintain the old blog linked to above, however you can find the domxml tool here: https://alexandre.alapetite.fr/doc-alex/domxml-php4-php5/index.en.html
Check that you have the module enabled and also that you have all required libraries.
May be you have forget to uncomment or add
extension=php_domxml.dll
in your php.ini file?

Categories