@@ -842,10 +842,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
842842 connection -> info -> lock .fp = php_stream_open_wrapper (lock_name , lock_file_mode , STREAM_MUST_SEEK |REPORT_ERRORS |IGNORE_PATH |persistent_flag , & opened_path );
843843 if (connection -> info -> lock .fp ) {
844844 if (is_db_lock ) {
845- ZEND_ASSERT (opened_path );
846- /* replace the path info with the real path of the opened file */
847- zend_string_release_ex (connection -> info -> path , persistent );
848- connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
845+ if (opened_path ) {
846+ /* replace the path info with the real path of the opened file */
847+ zend_string_release_ex (connection -> info -> path , persistent );
848+ connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
849+ } else {
850+ error = "Unable to determine path for locking" ;
851+ }
849852 }
850853 }
851854 if (opened_path ) {
@@ -862,10 +865,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
862865 zval_ptr_dtor (return_value );
863866 RETURN_FALSE ;
864867 }
865- if (!php_stream_supports_lock (connection -> info -> lock .fp )) {
868+ if (!error && ! php_stream_supports_lock (connection -> info -> lock .fp )) {
866869 error = "Stream does not support locking" ;
867870 }
868- if (php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
871+ if (! error && php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
869872 error = "Unable to establish lock" ; /* force failure exit */
870873 }
871874 }
0 commit comments