Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.0] Not compatible with PHP 5 #12909

Closed
remicollet opened this issue Jun 19, 2017 · 21 comments
Closed

[3.2.0] Not compatible with PHP 5 #12909

remicollet opened this issue Jun 19, 2017 · 21 comments
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@remicollet
Copy link
Contributor

Using 5.6.30

PHP Warning: PHP Startup: Unable to load dynamic library '/builddir/build/BUILDROOT/php-phalcon3-3.2.0-1.fc24.remi.5.6.x86_64/usr/lib64/php/modules/phalcon.so' - /builddir/build/BUILDROOT/php-phalcon3-3.2.0-1.fc24.remi.5.6.x86_64/usr/lib64/php/modules/phalcon.so: undefined symbol: zend_error_noreturn in Unknown on line 0

zend_error_noreturn is part of PHP public API in 7+ only

5.6.30:
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));

7.0.20
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);

@remicollet
Copy link
Contributor Author

Notice: it fails on startup when PHP is built with some special option, but it will segfault on runtime with default PHP build options.

@remicollet
Copy link
Contributor Author

Issue could be in zephir (latest tagged version 0.9.8 used)

@sergeyklay sergeyklay self-assigned this Jun 19, 2017
@sergeyklay
Copy link
Contributor

sergeyklay commented Jun 19, 2017

@remicollet

$ pwd
/home/vagrant/workspace/cphalcon/build
$ grep -r zend_error_noreturn . | grep -v "^Binary file" | awk -F':' '{print $1}'
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/32bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/64bits/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
./php5/safe/phalcon.zep.c
$ php -v
PHP 5.5.38 (cli) (built: May  9 2017 15:49:23) (DEBUG)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
$ sudo ./install --phpize $(phpenv which phpize) --php-config $(phpenv which php-config)

...

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /home/vagrant/.phpenv/versions/5.5.38-nts-debug/lib/php/extensions/debug-non-zts-20121212/
Installing header files:          /home/vagrant/.phpenv/versions/5.5.38-nts-debug/include/php/

Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation
$ php --ri phalcon

phalcon


Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.0
Build Date => Jun 19 2017 17:52:17
Powered by Zephir => Version 0.9.8-6335775f25

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off
$ php -r "echo Phalcon\Version::get() . PHP_EOL;"
3.2.0
$ php-config --configure-options | sed -e "s/ --/\n--/g"
--with-config-file-path=/home/vagrant/.phpenv/versions/5.5.38-nts-debug/etc
--with-config-file-scan-dir=/home/vagrant/.phpenv/versions/5.5.38-nts-debug/etc/conf.d
--prefix=/home/vagrant/.phpenv/versions/5.5.38-nts-debug
--libexecdir=/home/vagrant/.phpenv/versions/5.5.38-nts-debug/libexec
--without-pear
--with-gd
--enable-sockets
--with-jpeg-dir=/usr
--with-png-dir=/usr
--enable-exif
--enable-zip
--with-zlib
--with-zlib-dir=/usr
--with-bz2
--with-kerberos
--with-openssl
--with-mcrypt=/usr
--enable-soap
--enable-xmlreader
--with-xsl
--enable-ftp
--enable-cgi
--with-curl=/usr
--with-tidy
--with-xmlrpc
--enable-sysvsem
--enable-sysvshm
--enable-shmop
--with-pdo-mysql=mysqlnd
--with-pdo-sqlite
--enable-pcntl
--with-readline
--enable-mbstring
--disable-debug
--enable-fpm
--enable-bcmath
--enable-phpdbg
--with-mysql=mysqlnd
--enable-debug
--disable-fpm
--with-libdir=lib64

Also as you can see the tests on Travis (PHP5/PHP7) pass successfully.

PHP is built with some special option

Which one? Could you elaborate on that? I need steps to reproduce.

Cc: @phalcon/collaborators Does anyone faced with this?

@remicollet
Copy link
Contributor Author

Which one? Could you elaborate on that? I need steps to reproduce.

Some Linux distributions use RTLD_NOW (all symbols resolved at startup) instead of RTLD_LAZY (resolved at runtime) for security enhancement reason.

@remicollet
Copy link
Contributor Author

remicollet commented Jun 20, 2017

@sergeyklay
Copy link
Contributor

@remicollet Well, anyway I need to reproduce this to be able debug. So I'll try to sort out.

zend_error_noreturn is part of PHP public API in 7+ only

Could you please explain this a bit more? What you mean "in 7+ only"?

https://github.com/php/php-src/blob/PHP-5.5/Zend/zend.h#L294

@remicollet
Copy link
Contributor Author

remicollet commented Jun 20, 2017

Could you please explain this a bit more? What you mean "in 7+ only"?

There is no ZEND_API, so not public, not usable (may me different according of compiler default visibility)

@remicollet
Copy link
Contributor Author

$ objdump -T /usr/bin/php56  | grep zend_error
00000000002450a0 g    DF .text	0000000000000d07  Base        zend_error
000000000064c210 g    DO .bss	0000000000000008  Base        zend_error_cb
$ objdump -T /usr/bin/php70  | grep zend_error
00000000000c8b93 g    DF .text	0000000000000705  Base        zend_error
00000000000c8b93 g    DF .text	0000000000000705  Base        zend_error_noreturn
000000000063f900 g    DO .bss	0000000000000008  Base        zend_error_cb

@remicollet
Copy link
Contributor Author

I need to reproduce this to be able debug. So I'll try to sort out.

Use distro packages ;)

@remicollet
Copy link
Contributor Author

BTW, the fix is trivial
sed -e s/zend_error_noreturn/zend_error/ ...

@sergeyklay
Copy link
Contributor

@remicollet

BTW, the fix is trivial
sed -e s/zend_error_noreturn/zend_error/ ...

So can I not rush with patch for 3.2.0 and do it in 3.2.1?

@remicollet
Copy link
Contributor Author

So can I not rush with patch for 3.2.0 and do it in 3.2.1?

Your project, your priority, your choice.

BTW, I was able to build 3.2.0 for 5.5, 5.6, 7.0 and 7.1 (haven't try 7.2 yet), other users could encounter the same issue, or segfault at runtime, which is IMHO worse...

Perhaps everybody have switched to 7+, and you can wait for other reports

@sergeyklay
Copy link
Contributor

sergeyklay commented Jun 20, 2017

Sure. But actually, it was important for me to hear exactly your opinion, because you maintain package repos for RPM based distros. Is this prevent you to release Phalcon 3.2.0 for PHP 5.x or not?

@sergeyklay sergeyklay added this to the 3.2.x milestone Jun 20, 2017
@remicollet
Copy link
Contributor Author

Is this prevent you to release Phalcon or not?

No, as I patch sources to drop zend_error_noreturn usage

Notice: zend_error_noreturn does exactly the same than zend_error, only exists to avoid compiler warnings

void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));

@remicollet
Copy link
Contributor Author

Test build: version 3.2.0 using zephir 0.9.9 => OK.

@Jurigag
Copy link
Contributor

Jurigag commented Jun 21, 2017

Great, soe we should release 3.2.1 right now imho.

@kornerita
Copy link

Hi,

For MacOS 10.12.5 seems to be working:

$ uname -a
Darwin <my computer> 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

$ php --version
PHP 5.6.30 (cli) (built: Feb  7 2017 16:18:37) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

$ php --ri phalcon

phalcon


Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.0
Build Date => Jun 21 2017 07:00:15
Powered by Zephir => Version 0.9.8-6335775f25

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off

For FreeBSD 10.3 also seems to be working:

# uname -a        
FreeBSD <my server> 10.3-RELEASE-p18 FreeBSD 10.3-RELEASE-p18 #0: Tue Apr 11 10:31:00 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

# php --version
PHP 5.6.30 (cli) (built: Jan 23 2017 08:28:33) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

# php --ri phalcon

phalcon


Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.0
Build Date => Jun 20 2017 10:10:50
Powered by Zephir => Version 0.9.8-6335775f25

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off

I had that problem when I compiled it for my raspberry pi with debian, but I'm not at home atm to give you more information.

@kornerita
Copy link

Linux Debian raspberry not working:

$ uname -a
Linux raspberrypi 4.9.26v7-aufs #1 SMP Tue May 9 20:14:03 CEST 2017 armv7l GNU/Linux

$ php --version
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/phalcon.so' - /usr/lib/php5/20131226/phalcon.so: undefined symbol: zend_error_noreturn in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/phalcon.so' - /usr/lib/php5/20131226/phalcon.so: undefined symbol: zend_error_noreturn in Unknown on line 0
PHP 5.6.30-0+deb8u1 (cli) (built: Apr 14 2017 16:20:58) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ php --ri phalcon
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/phalcon.so' - /usr/lib/php5/20131226/phalcon.so: undefined symbol: zend_error_noreturn in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/phalcon.so' - /usr/lib/php5/20131226/phalcon.so: undefined symbol: zend_error_noreturn in Unknown on line 0
Extension 'phalcon' not present.

@kornerita
Copy link

Redhat linux 6.2, php 5.6.28, custom build:

# uname -a
Linux <my server> 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

# php --info | head
phpinfo()
PHP Version => 5.6.28

System => Linux <my server> 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64
Build Date => Dec  6 2016 14:28:57
Configure Command =>  './configure'  '--prefix=/usr/local/php5' '--enable-sigchild' '--with-png-dir=/usr/lib' '--with-jpeg-dir=/usr/lib' '--with-mysql' '--with-zlib' '--enable-gd-native-ttf' '--enable-calendar' '--enable-mbstring' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-kerberos' '--with-ldap' '--with-imap-ssl' '--enable-ftp' '--with-openssl' '--with-curl=/usr' '--with-pear' '--with-mcrypt=/usr/local/lib' '--with-mhash=/usr/local/lib' '--enable-shmop' '--enable-sysvsem' '--enable-soap' '--with-xmlrpc' '--with-gd' '--with-gettext' '--with-iconv' '--enable-mbstring=all' '--enable-mbregex' '--with-iconv-dir=/usr/local/lib' '--with-libdir=lib64'

# php --ri phalcon

phalcon


Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.0
Build Date => Jun 21 2017 12:43:10
Powered by Zephir => Version 0.9.8-6335775f25

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
phalcon.orm.update_snapshot_on_save => On => On
phalcon.orm.disable_assign_setters => Off => Off

@Jurigag
Copy link
Contributor

Jurigag commented Jun 21, 2017

You sure you used zephir to compile?

@sergeyklay
Copy link
Contributor

@remicollet Fixed in master branch and in the current 3.2.x branch.

sergeyklay added a commit to phalcon/packagecloud that referenced this issue Jun 21, 2017
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

5 participants